Skip to content

Instantly share code, notes, and snippets.

@waleedsamy
Created August 8, 2017 15:28
Show Gist options
  • Save waleedsamy/926991840ed3d2ce0768c7286f648a5b to your computer and use it in GitHub Desktop.
Save waleedsamy/926991840ed3d2ce0768c7286f648a5b to your computer and use it in GitHub Desktop.
why bind async.js? because I can.
const async = require('async');
let ob = {
'x': 8,
'y': 16
}
function ci(callback) {
console.log('ci', this.x, this.y);
callback(null, 'berlin')
}
function ch(callback) {
console.log('ch', this.x, this.y);
callback(null, '2017-08-09');
}
function du(callback) {
console.log('du', this.x, this.y);
callback(null, '3');
}
async.series({
city: ci.bind(ob),
checkin: ch.bind(ob),
duration: du.bind(ob),
}, function(err, results) {
console.log(results);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment