-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Feature request: add Ruby's each_cons
and each_slice
methods
#252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@utkarshkukreti Thanks for the suggestion, but these special cased |
Extensions like this will be easier to put together when we provide pre-sliced AMD/CommonJS/Node modules in the next major bump. |
I know this is an old request, but I would really like to understand the rationale behind these rejections. I mean, almost everything in this library is a |
Just as an FYI to anybody else searching for functionality similar to Ruby's |
in |
https://stackoverflow.com/a/48541301/2180570 const zipAdjacent = function<T> (ts: T[]): [T, T][] {
return zip(dropRight(ts, 1), tail(ts));
}; https://stackoverflow.com/a/67602261/2180570 const pairWise = a => a.slice(1).map((k,i) => [a[i], k]); by loop |
It would be nice to have the equivalent of
each_cons
andeach_slice
methods Ruby's Enumerable module has.Something like:
and probably also accept a callback as second param like many existing functions do.
Let me know if you'd like this to be in lodash, I would try to send in a pull request if I can.
The text was updated successfully, but these errors were encountered: