summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2015-07-01 11:45:24 -0400
committerGraeme Yeates <yeatesgraeme@gmail.com>2015-07-01 11:45:24 -0400
commit8ed48ae172d90f7e1dc2e45e865365f01811d26b (patch)
treea958a506a5e3c648bc37d8b86880faf5e2e5f2b2 /lib
parent55739bf94e49b7b230f1dc5ad96e44d7fde513e8 (diff)
downloadasync-8ed48ae172d90f7e1dc2e45e865365f01811d26b.tar.gz
Comment out unused restParam implementation
Diffstat (limited to 'lib')
-rw-r--r--lib/async.js17
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);
};
}