-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add support for multiple predicates to is.any
#104
Add support for multiple predicates to is.any
#104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update readme to document new behavior.
readme.md
Outdated
@@ -432,6 +432,20 @@ is.any(is.boolean, 'unicorns', [], new Map()); | |||
//=> false | |||
``` | |||
|
|||
See below for use with multiple predicates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's preferred, I can document both usages in the same block, perhaps like .any(predicate|predicates[], ...values)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a thumbs-up, should I put them in the same block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just saw that you separated single and multiple predicates to different blocks. I think it's better. Keep it as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I updated it before seeing this latest comment. Please let me know what I should do.
is.any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1a61b0e
to
b662c7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
readme.md
Outdated
@@ -420,9 +420,9 @@ Returns `true` if `value` is an even integer. | |||
|
|||
Returns `true` if `value` is an odd integer. | |||
|
|||
##### .any(predicate, ...values) | |||
##### .any(predicate | predicates[], ...values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
predicates[]
-> predicate[]
, they're the same type.
readme.md
Outdated
@@ -432,6 +432,16 @@ is.any(is.boolean, 'unicorns', [], new Map()); | |||
//=> false | |||
``` | |||
|
|||
Using an array of `predicates`, returns `true` if **any** of the input `values` returns true for **any** of the `predicates` provided in an array: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Using an array of predicate[]
..."
Thanks @scraggo! 🎉 |
Thanks for letting me contribute! 😄 |
Fixes #98
Open to all commentary, especially on type declarations!