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

find* methods should return optional element #201

Open
kylef opened this issue Nov 13, 2018 · 0 comments
Open

find* methods should return optional element #201

kylef opened this issue Nov 13, 2018 · 0 comments

Comments

@kylef
Copy link
Member

kylef commented Nov 13, 2018

This is a breaking change and I would wait a bit before we do this to settle the current unreleased changes.

We should rename the current find* methods to filter* because in JavaScript find methods are expected to return the single element and our implementation if the method is inconsistent. We should implement find* to return first matching item.

Take the following example:

// JS Array `find`
["a", "b", "c"].find(c => c === "b"); // "b"
// Array Element `find`
ArrayElement(["a", "b", "c"]).find(c => c.toValue() === "b"); // ["b"]
// We return array slice of B not just B.
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

No branches or pull requests

1 participant