Skip to content

Instantly share code, notes, and snippets.

@robertklep
Last active December 18, 2015 04:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertklep/5729837 to your computer and use it in GitHub Desktop.
Save robertklep/5729837 to your computer and use it in GitHub Desktop.
var f = function(value) {
console.log('value:', value);
};
var x = f.bind(f, 'foo'); // pass 'foo' as a pre-specified argument to f(), and return it as a new function x()
x();
var async = require('async');
var test = function(locals, callback) {
console.log('locals:', locals);
callback(null);
};
function run() {
var locals = [ 'a', 'b', 'c' ];
async.series([
test.bind(test /* or null, or ... */, locals)
], function(err) {
console.log('error?', err); // should say 'error? null'
});
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment