(func, startIndex)
| 155 | // This accumulates the arguments passed into an array, after a given index. |
| 156 | // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). |
| 157 | function _restParam(func, startIndex) { |
| 158 | startIndex = startIndex == null ? func.length - 1 : +startIndex; |
| 159 | return function() { |
| 160 | var length = Math.max(arguments.length - startIndex, 0); |
| 161 | var rest = Array(length); |
| 162 | for (var index = 0; index < length; index++) { |
| 163 | rest[index] = arguments[index + startIndex]; |
| 164 | } |
| 165 | switch (startIndex) { |
| 166 | case 0: return func.call(this, rest); |
| 167 | case 1: return func.call(this, arguments[0], rest); |
| 168 | } |
| 169 | // Currently unused but handle cases outside of the switch statement: |
| 170 | // var args = Array(startIndex + 1); |
| 171 | // for (index = 0; index < startIndex; index++) { |
| 172 | // args[index] = arguments[index]; |
| 173 | // } |
| 174 | // args[startIndex] = rest; |
| 175 | // return func.apply(this, args); |
| 176 | }; |
| 177 | } |
| 178 | |
| 179 | function _withoutIndex(iterator) { |
| 180 | return function (value, index, callback) { |
no test coverage detected