* A specialized version of `baseCallback` which only supports `this` binding * and specifying the number of arguments to provide to `func`. * * @private * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {number} [
(func, thisArg, argCount)
| 4417 | * @returns {Function} Returns the callback. |
| 4418 | */ |
| 4419 | function bindCallback(func, thisArg, argCount) { |
| 4420 | if (typeof func != 'function') { |
| 4421 | return identity; |
| 4422 | } |
| 4423 | if (thisArg === undefined) { |
| 4424 | return func; |
| 4425 | } |
| 4426 | switch (argCount) { |
| 4427 | case 1: return function(value) { |
| 4428 | return func.call(thisArg, value); |
| 4429 | }; |
| 4430 | case 3: return function(value, index, collection) { |
| 4431 | return func.call(thisArg, value, index, collection); |
| 4432 | }; |
| 4433 | case 4: return function(accumulator, value, index, collection) { |
| 4434 | return func.call(thisArg, accumulator, value, index, collection); |
| 4435 | }; |
| 4436 | case 5: return function(value, other, key, object, source) { |
| 4437 | return func.call(thisArg, value, other, key, object, source); |
| 4438 | }; |
| 4439 | } |
| 4440 | return function() { |
| 4441 | return func.apply(thisArg, arguments); |
| 4442 | }; |
| 4443 | } |
| 4444 | |
| 4445 | /** |
| 4446 | * Creates a clone of the given array buffer. |
no test coverage detected