dtao / lazy.js

Like Underscore, but lazier
http://danieltao.com/lazy.js/
MIT License
6.01k stars 268 forks source link

GroupedSequence - 'slice' method is missing #211

Closed x1unix closed 6 years ago

x1unix commented 7 years ago

Please add slice method from ArrayLikeSequence, or better extend GroupedSequence from ArrayLikeSequence instead of ObjectSequence to allow array operations.

dtao commented 6 years ago

How would that work? GroupedSequence is not "like" an array; it is "like" an object. Its interface inherits from ObjectLikeSequence because it makes sense to perform operations on it that you would perform on an object; i.e., getting the value(s) associated with a key. You cannot slice a grouped sequence for the same reason you cannot slice an object.