mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
Optimize lazy slice for start of 0 and an end value.
This commit is contained in:
@@ -12342,8 +12342,13 @@
|
||||
|
||||
LazyWrapper.prototype.slice = function(start, end) {
|
||||
start = start == null ? 0 : (+start || 0);
|
||||
var result = start < 0 ? this.takeRight(-start) : this.drop(start);
|
||||
|
||||
var result = this;
|
||||
if (start < 0) {
|
||||
result = this.takeRight(-start);
|
||||
} else if (start) {
|
||||
result = this.drop(start);
|
||||
}
|
||||
if (end !== undefined) {
|
||||
end = (+end || 0);
|
||||
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
|
||||
|
||||
Reference in New Issue
Block a user