callback-end

0.0.2 • Public • Published

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(){}]
);

Package Sidebar

Install

npm i callback-end

Weekly Downloads

2

Version

0.0.2

License

none

Last publish

Collaborators

  • kjirou