We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
find
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
I'm thinking this will be better because it won't continue to process the remainder of the array after finding a match.
find :: forall a. (a -> Boolean) -> Array a -> Maybe a find p xs = findIndex p xs >>= index x
The text was updated successfully, but these errors were encountered:
@themattchan came up with this, which is even better:
find :: forall a. (a -> Boolean) -> Array a -> Maybe a find f xs = unsafePartial $ unsafeIndex xs <$> findIndex f xs
Sorry, something went wrong.
This was done in #189.
No branches or pull requests
I'm thinking this will be better because it won't continue to process the remainder of the array after finding a match.
The text was updated successfully, but these errors were encountered: