mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Add LazyWrapper#slice.
This commit is contained in:
11
lodash.js
11
lodash.js
@@ -10075,6 +10075,17 @@
|
||||
});
|
||||
};
|
||||
|
||||
LazyWrapper.prototype.slice = function(start, end) {
|
||||
start = start == null ? 0 : (+start || 0);
|
||||
var result = start < 0 ? this.takeRight(-start) : this.drop(start);
|
||||
|
||||
if (typeof end != 'undefined') {
|
||||
end = (+end || 0);
|
||||
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// add `LazyWrapper` methods to `LodashWrapper`
|
||||
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
||||
var retUnwrapped = /^(?:first|last)$/.test(methodName);
|
||||
|
||||
Reference in New Issue
Block a user