Skip to content

Instantly share code, notes, and snippets.

@dfellis
Forked from jingidy/functions.js
Last active December 19, 2015 01:59
Show Gist options
  • Save dfellis/5879675 to your computer and use it in GitHub Desktop.
Save dfellis/5879675 to your computer and use it in GitHub Desktop.
var q = require('queue-flow');
function asyncEmptyArray (args, callback) {
console.log('empty array');
callback(null, []);
}
function poof (callback) {
q([null])
.node(asyncEmptyArray, callback)
.map(function(arr) { return [arr]; })
.node(function (items, cb) {
console.log('items: ' + JSON.stringify(items))
console.log('cb: ' + cb)
cb();
}, callback)
.on('close', function () { callback(); });
}

Calling:

poof( function (err) { console.log(err ? err : 'done'); });

Result:

empty array
items: []
cb: function () { [native code] }
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment