-
-
Save EdJ/2eed46430a9d184c0fef to your computer and use it in GitHub Desktop.
Short example of something I'm a bit confused about in the current implementation of Asynquence's map() implementation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ASQ = require('asynquence'); | |
require('asynquence-contrib'); | |
var returnsArr = function returnsArr(c) { c && c([1]); return [1]}; | |
ASQ().map(returnsArr(), function (v, c) { c(v + 1) }); // fine | |
ASQ().then(returnsArr).map(function (v, c) { c(v + 1) }); // doesn't work |
After thinking it over, I decided to update map(..)
itself to handle this use-case. Was a simple addition and there was no need for a separate plugin.
Thanks for the idea! :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also do:
And of course, if that was a common use-case for you, it'd be pretty trivial to make that usage of the API into a simple plugin. Almost any usage of the ASQ API can be rolled into a plugin.