Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/async.util.restparam/index.js
1126 views
1
'use strict';
2
module.exports = function restParam(func, startIndex) {
3
startIndex = startIndex == null ? func.length - 1 : +startIndex;
4
return function() {
5
var length = Math.max(arguments.length - startIndex, 0);
6
var rest = new Array(length);
7
for (var index = 0; index < length; index++) {
8
rest[index] = arguments[index + startIndex];
9
}
10
switch (startIndex) {
11
case 0:
12
return func.call(this, rest);
13
case 1:
14
return func.call(this, arguments[0], rest);
15
}
16
};
17
};
18
19