mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
39
react-app/node_modules/lodash/internal/bindCallback.js
generated
vendored
Normal file
39
react-app/node_modules/lodash/internal/bindCallback.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var identity = require('../utility/identity');
|
||||
|
||||
/**
|
||||
* 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} [argCount] The number of arguments to provide to `func`.
|
||||
* @returns {Function} Returns the callback.
|
||||
*/
|
||||
function bindCallback(func, thisArg, argCount) {
|
||||
if (typeof func != 'function') {
|
||||
return identity;
|
||||
}
|
||||
if (thisArg === undefined) {
|
||||
return func;
|
||||
}
|
||||
switch (argCount) {
|
||||
case 1: return function(value) {
|
||||
return func.call(thisArg, value);
|
||||
};
|
||||
case 3: return function(value, index, collection) {
|
||||
return func.call(thisArg, value, index, collection);
|
||||
};
|
||||
case 4: return function(accumulator, value, index, collection) {
|
||||
return func.call(thisArg, accumulator, value, index, collection);
|
||||
};
|
||||
case 5: return function(value, other, key, object, source) {
|
||||
return func.call(thisArg, value, other, key, object, source);
|
||||
};
|
||||
}
|
||||
return function() {
|
||||
return func.apply(thisArg, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = bindCallback;
|
Reference in New Issue
Block a user