mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Avoid trailing slice unless needed.
This commit is contained in:
@@ -10819,12 +10819,15 @@
|
|||||||
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
|
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
|
||||||
return baseRest(function(args) {
|
return baseRest(function(args) {
|
||||||
var array = args[start],
|
var array = args[start],
|
||||||
|
lastIndex = args.length - 1,
|
||||||
otherArgs = castSlice(args, 0, start);
|
otherArgs = castSlice(args, 0, start);
|
||||||
|
|
||||||
if (array) {
|
if (array) {
|
||||||
arrayPush(otherArgs, array);
|
arrayPush(otherArgs, array);
|
||||||
}
|
}
|
||||||
arrayPush(otherArgs, castSlice(args, start + 1));
|
if (start != lastIndex) {
|
||||||
|
arrayPush(otherArgs, castSlice(args, start + 1));
|
||||||
|
}
|
||||||
return apply(func, this, otherArgs);
|
return apply(func, this, otherArgs);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user