From 5fc812723019a90cfe1f01ff2de424df03cefe33 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 19 Oct 2015 06:13:23 -0400 Subject: [PATCH] refactor(util) exec.with --- lib/util.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/util.js b/lib/util.js index c7698b4e..6460faf2 100644 --- a/lib/util.js +++ b/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); + }; }; /**