So I am running a NodeJS Serverless instance, using Knex.js as my DB middleware. When attempting to return JUST the value from a request to Knex, I always get [ { vrn: 'xx12xyz' } ]. I have tried using Object(), does anyone have a quick one liner or small helper function that can help me flatten this into a direct array such that I can pick out JUST the value?
This is the code I am using:
const vrnList = await db('vehicles').select('vrn').where('id', '=', '1');
console.log("The quick car with the VRN ", Object.values(vrnList), " overtook me on the freeway");
TL;DR: Splitting the object and array id from the values