Skip to content
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

Documentation of _.slice() negative indexes #3627

Closed
timo-lindemann-victors opened this issue Feb 5, 2018 · 6 comments
Closed

Documentation of _.slice() negative indexes #3627

timo-lindemann-victors opened this issue Feb 5, 2018 · 6 comments
Labels

Comments

@timo-lindemann-victors
Copy link

The documentation of _.slice() does not mention that negative indexing is supported at all (but it is):

_.slice([1, 2, 3, 4], -1) // [4]
_.slice([1, 2, 3, 4], -2) // [3, 4]
_.slice([1, 2, 3, 4], -2, -1) // [3]

Is this not mentioned in the documentation intentionally, does it mean it's not reliable, or is it simply an omission (doc bug)?

@timo-lindemann-victors timo-lindemann-victors changed the title Documentation of _.slice() Documentation of _.slice() negative indexes Feb 5, 2018
@jdalton
Copy link
Member

jdalton commented Feb 5, 2018

Hi @timo-lindemann-victors!

I think the shoutout to the Array#slice method, which supports negative indexes, covers it.

@jdalton jdalton closed this as completed Feb 5, 2018
@timo-lindemann-victors
Copy link
Author

Thanks for your reply.

I severely disagree. You document the parameters shortly thereafter, and nothing of the sort is mentioned there; in fact, you only reference Array#slice because you want to tell people that "dense arrays" are returned (which isn't helpful at all for this; ask any random JS dev and chances are they don't even know what that is).

I am replying to this because now I cannot use negative indexing because superiors think it's unreliable (because undocumented) behaviour. If stringent documentation is not important to you, I can live with that; they, as it seems, can't.

@jdalton
Copy link
Member

jdalton commented Feb 6, 2018

Ah, that's a bummer. For them, Array#slice may be your best bet.

@jnfingerle
Copy link
Contributor

@jdalton So, there's an omission in the docs. Your argument that it's covered anyway is shown by @timo-lindemann-victors to be invald. But you don't want to fix it - because. I'm a bit troubled, that complete documentation seems to be of no concern to you.

jdalton pushed a commit that referenced this issue Feb 6, 2018
Even though #3627 has been closed, negative indexes should be documented.
@jdalton
Copy link
Member

jdalton commented Feb 6, 2018

Thanks for the PR @jnfingerle!

@lock
Copy link

lock bot commented Feb 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants