var localEncounters = [];
var localEncounter = {};
This code is hard to read.
- avoid "global" state
- a['b'] is easier to read as a.b
- you're using localEncounter across many ids that overwrite the same attributes
Instead, you could e.g. pass your accumulated state with "return promiseFn(…).then(function(res){return {state_and_res});
Wout.
--
You received this message because you are subscribed to the Google Groups "Q Continuum (JavaScript)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to q-continuum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wout.
(typed on mobile, excuse terseness)
Briefly looked over what you’re doing, and noticed two things.
localEncounter
to localEncounters
, you are not pushing a unique clone of localEncounter
. If you edit localEncounter
in the future, it will edit all instances of it pushed to localEncounters
.localEncounter
and localEncounters
outside of your map function and promises? You could have the map function return a promise for each local encounter and then have Promise.all( ids.map( ... ) ).then(function (localEncounters) { ...})
. The result of Promise.all
can be local encounters.Maybe I’m off with what you are doing, but those two things might be related to your issue.
--
You received this message because you are subscribed to the Google Groups "Q Continuum (JavaScript)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to q-continuum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.