Skip to content

Instantly share code, notes, and snippets.

@getify
Forked from broguinn/ASQ Map
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save getify/e94ea48190e9523fcf9b to your computer and use it in GitHub Desktop.
Save getify/e94ea48190e9523fcf9b to your computer and use it in GitHub Desktop.
//In asynquence-contrib
var emptyItems = [],
sq = ASQ();
sq.map(emptyItems, function(item, done){
// do some things to item
item.values = [];
done(item);
});
sq.map(function(item, done) {
ASQ().map(item.values, function(value, valueDone) {
valueDone(value);
});
});
//In asynquence-contrib
var emptyItems = [],
sq = ASQ();
sq.map(emptyItems, function(item, done){
// do some things to item
item.values = [];
done(item);
});
sq.map(function(item, done) {
ASQ().map(item.values, function(value, valueDone) {
valueDone(value);
})
.pipe(done); // <-- you need this line
});
sq.val(function(items){
console.log(items); // an array of `{ values: [..] }` tuples
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment