You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say we are using async.map or really almost any of the async utilities
My question/feature request is - if the task array/set is empty, does async fire the final callback on the next tick? If not, is there a way to tell async to do that? Would be a nice feature.
Otherwise, I have a lot of this in my code, which is more verbose:
Hey @ORESoftware, thanks for the question! For an empty array/set, async invokes the final callback on the same tick as built-in deferrals were removed in v2.0.0 for performance reasons (I don't think async < v2.0.0 even had a built-in deferral for this case though).
constasyncMap=async.ensureAsync(async.map);// then call `asyncMap` just as you would `async.map`
Otherwise, the process.nextTick approach you proposed is perfectly valid. Although, if you are writing code that might get used in a browser, you should take a look at async.setImmediate or async.nextTick.
Say we are using async.map or really almost any of the async utilities
My question/feature request is - if the task array/set is empty, does async fire the final callback on the next tick? If not, is there a way to tell async to do that? Would be a nice feature.
Otherwise, I have a lot of this in my code, which is more verbose:
to avoid Zalgo, this above is necessary, but, it is a lot nicer to do:
I guess one thing we could is check if the array is empty, and if so, return early with
what do yall recommend?
The text was updated successfully, but these errors were encountered: