-
Notifications
You must be signed in to change notification settings - Fork 3
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
slice(-10, -2) === slice(0, 8) #25
Comments
Yeah I didn't really give any thought to negative arguments and haven't said anything about that in the docs. I see you handle it like this https://github.com/xgbuils/iterarray/blob/master/src/index.js#L39 I'm thinking if any of the arguments are negative I'll just handle it like native |
I like your approach following the native slice behaviour. But it's a bit eager for infinite iterables. |
And if you want to assume this eager behaviour, I suggest to put |
That then breaks the behavior with negative indices: |
It's true. When I said that, I was thinking on |
Ah yeah, very good point then! I'll add a test case, make the change then merge this |
I analyzed the code for
slice
implementation and it seems thatslice(-10, -2)
behaves equal thanslice(0, 8)
. Is the expected behaviour?The text was updated successfully, but these errors were encountered: