0.0.2 • Published 10 years ago

callback-end v0.0.2

Weekly downloads
11
License
-
Repository
github
Last release
10 years ago

callback-end Build Status

By wrapping the function that sets the last callback, so that you can omit the argument when calling.

Installation

npm install callback-end

Examples

var callbackEnd = require('callback-end');


var func = function(foo, bar, cb){
  return Array.prototype.slice.apply(arguments);
};

var wrapped = callbackEnd(func);

console.log(
  wrapped(1, 2, function(){})  // -> [1, 2, function(){}]
);

// Omit a "bar" arg
console.log(
  wrapped(1, function(){})  // -> [1, undefined, function(){}]
);

// Omit "foo" and "bar" args
console.log(
  wrapped(function(){})  // -> [undefined, undefined, function(){}]
);
0.0.2

10 years ago

0.0.1

10 years ago