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