I'm using Lodash to do some work on our object. So I had a little problem that I can't solve.
I'm trying to add the result of a query, in the _.transform array. But without success.
The return is empty.
I did some tests using the console.log and the value is shown normally.
const result = _.transform(data.items, async (r: any, v: any) => {
let data = await Cliente.query().where('id', '=', v.codiPsv).orderBy('validade', 'asc').first()
if (data){
console.log(data.serialize()) --> Show object
r.push(data.serialize())
console.log(0)
}
})
console.log(result) --> empty