Skip to content

Conversation

@nlwillia
Copy link

This adds a couple of methods that are useful for locating specific elements as part of a lazy, array-like traversal. Without them you would have to use some or reduce or toArray which are inefficient if you just want to locate an element and quit. This could be generalized with a (hypothetical) reduceUntil method, but I think the find cases are conventional enough to be expected and be worth supporting directly as is already done with some.

See:
find (MDN)
findIndex (MDN)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant