Consolidate over modules.

This commit is contained in:
John-David Dalton
2017-01-11 12:11:56 -08:00
parent 36927bff8b
commit 3b4cbc70e7
5 changed files with 27 additions and 36 deletions

View File

@@ -1,8 +1,4 @@
import apply from './.internal/apply.js';
import baseFlatten from './.internal/baseFlatten.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeMin = Math.min;
/**
* Creates a function that invokes `func` with its arguments transformed.
@@ -10,7 +6,7 @@ const nativeMin = Math.min;
* @since 4.0.0
* @category Function
* @param {Function} func The function to wrap.
* @param {...(Function|Function[])} [transforms=[identity]]
* @param {Function[]} [transforms=[identity]]
* The argument transforms.
* @returns {Function} Returns the new function.
* @example
@@ -31,12 +27,11 @@ const nativeMin = Math.min;
* func(10, 5);
* // => [100, 10]
*/
function overArgs(func, ...transforms) {
function overArgs(func, transforms) {
const funcsLength = transforms.length;
return function(...args) {
let index = -1;
const length = nativeMin(args.length, funcsLength);
const length = Math.min(args.length, funcsLength);
while (++index < length) {
args[index] = transforms[index].call(this, args[index]);
}