diff options
author | Graeme Yeates <yeatesgraeme@gmail.com> | 2015-07-01 11:45:24 -0400 |
---|---|---|
committer | Graeme Yeates <yeatesgraeme@gmail.com> | 2015-07-01 11:45:24 -0400 |
commit | 8ed48ae172d90f7e1dc2e45e865365f01811d26b (patch) | |
tree | a958a506a5e3c648bc37d8b86880faf5e2e5f2b2 /lib | |
parent | 55739bf94e49b7b230f1dc5ad96e44d7fde513e8 (diff) | |
download | async-8ed48ae172d90f7e1dc2e45e865365f01811d26b.tar.gz |
Comment out unused restParam implementation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/async.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/async.js b/lib/async.js index 263f27f..5da3622 100644 --- a/lib/async.js +++ b/lib/async.js @@ -139,13 +139,13 @@ // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) // This accumulates the arguments passed into an array, after a given index. + // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). function _restParam(func, startIndex) { startIndex = startIndex == null ? func.length - 1 : +startIndex; return function() { var length = Math.max(arguments.length - startIndex, 0); var rest = Array(length); - var index; - for (index = 0; index < length; index++) { + for (var index = 0; index < length; index++) { rest[index] = arguments[index + startIndex]; } switch (startIndex) { @@ -153,12 +153,13 @@ case 1: return func.call(this, arguments[0], rest); case 2: return func.call(this, arguments[0], arguments[1], rest); } - var args = Array(startIndex + 1); - for (index = 0; index < startIndex; index++) { - args[index] = arguments[index]; - } - args[startIndex] = rest; - return func.apply(this, args); + // Currently unused but handle cases outside of the switch statement: + // var args = Array(startIndex + 1); + // for (index = 0; index < startIndex; index++) { + // args[index] = arguments[index]; + // } + // args[startIndex] = rest; + // return func.apply(this, args); }; } |