I've a _each() that inside got an await where I check a user state in MySQL
the mysql response return after cycle is already completed. there is a way that wait the method checkUserState(), beforse and than go to next element of _each()?
let obj = _.each(guest_list.guests, async function (value){
let user_state = await DataController.checkUserState('2305');
value.Owner.state = user_state;
console.log('state:' + user_state);
return value;
});
console.log('cycle complete')
return obj;
Result is: cycle complete state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb state:notdisturb