mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(util) exec.with
This commit is contained in:
parent
ca35d4e6c6
commit
5fc8127230
1 changed files with 8 additions and 5 deletions
13
lib/util.js
13
lib/util.js
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue