refactor(util) exec.with

This commit is contained in:
coderaiser 2015-10-19 06:13:23 -04:00
parent ca35d4e6c6
commit 5fc8127230

View file

@ -272,12 +272,15 @@
* return function that calls callback with arguments
*/
exec.with = function(callback) {
var args = [].slice.call(arguments),
bind = Function.prototype.bind;
var slice = Array.prototype.slice,
args = slice.call(arguments, 1);
args[0] = null;
return bind.apply(callback, args);
return function() {
var array = slice.call(arguments),
all = args.concat(array);
callback.apply(null, all);
};
};
/**