mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
# add dist
This commit is contained in:
57
ng2-components/ng2-alfresco-documentslist/dist/node_modules/lodash/overArgs.js
generated
vendored
Normal file
57
ng2-components/ng2-alfresco-documentslist/dist/node_modules/lodash/overArgs.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
var apply = require('./_apply'),
|
||||
arrayMap = require('./_arrayMap'),
|
||||
baseFlatten = require('./_baseFlatten'),
|
||||
baseIteratee = require('./_baseIteratee'),
|
||||
isFlattenableIteratee = require('./_isFlattenableIteratee'),
|
||||
rest = require('./rest');
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `func` with arguments transformed by
|
||||
* corresponding `transforms`.
|
||||
*
|
||||
* @static
|
||||
* @since 4.0.0
|
||||
* @memberOf _
|
||||
* @category Function
|
||||
* @param {Function} func The function to wrap.
|
||||
* @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
|
||||
* [transforms[_.identity]] The functions to transform.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* function doubled(n) {
|
||||
* return n * 2;
|
||||
* }
|
||||
*
|
||||
* function square(n) {
|
||||
* return n * n;
|
||||
* }
|
||||
*
|
||||
* var func = _.overArgs(function(x, y) {
|
||||
* return [x, y];
|
||||
* }, square, doubled);
|
||||
*
|
||||
* func(9, 3);
|
||||
* // => [81, 6]
|
||||
*
|
||||
* func(10, 5);
|
||||
* // => [100, 10]
|
||||
*/
|
||||
var overArgs = rest(function(func, transforms) {
|
||||
transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseIteratee);
|
||||
var funcsLength = transforms.length;
|
||||
return rest(function(args) {
|
||||
var index = -1,
|
||||
length = nativeMin(args.length, funcsLength);
|
||||
|
||||
while (++index < length) {
|
||||
args[index] = transforms[index].call(this, args[index]);
|
||||
}
|
||||
return apply(func, this, args);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = overArgs;
|
Reference in New Issue
Block a user