Make _.at support shortcut fusion in a chain sequence when operating on an array and selecting a single index. [closes #1636]

This commit is contained in:
John-David Dalton
2015-11-14 14:15:11 -08:00
parent 1c04dfe083
commit 783c23cbfb
2 changed files with 63 additions and 3 deletions

View File

@@ -13893,6 +13893,13 @@
};
});
LazyWrapper.prototype.at = rest(function(paths) {
paths = baseFlatten(paths);
return (paths.length == 1 && isIndex(paths[0]))
? this.slice(paths[0], paths[0] + 1)
: new LazyWrapper(this);
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity);
};