Optimize lazy slice for start of 0 and an end value.

This commit is contained in:
jdalton
2015-04-27 23:11:58 -07:00
parent df176dfe8a
commit bf89287c56

View File

@@ -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);