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

Add support for multiple predicates to is.any #104

Merged

Conversation

scraggo
Copy link
Contributor

@scraggo scraggo commented Feb 15, 2020

Fixes #98

Open to all commentary, especially on type declarations!

Copy link
Collaborator

@brandon93s brandon93s left a 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.

source/index.ts Show resolved Hide resolved
source/index.ts Outdated Show resolved Hide resolved
source/index.ts Outdated Show resolved Hide resolved
source/index.ts Outdated Show resolved Hide resolved
readme.md Outdated
@@ -432,6 +432,20 @@ is.any(is.boolean, 'unicorns', [], new Map());
//=> false
```

See below for use with multiple predicates.
Copy link
Contributor Author

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)

Copy link
Contributor Author

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?

Copy link
Collaborator

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

Copy link
Contributor Author

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.

@sindresorhus sindresorhus changed the title Add multiple predicates to is.any Add support for multiple predicates to is.any Feb 16, 2020
Copy link
Collaborator

@gioragutt gioragutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

readme.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@brandon93s brandon93s left a 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)
Copy link
Collaborator

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:
Copy link
Collaborator

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[]..."

@brandon93s brandon93s merged commit d1929ad into sindresorhus:master Feb 17, 2020
@brandon93s
Copy link
Collaborator

Thanks @scraggo! 🎉

@scraggo
Copy link
Contributor Author

scraggo commented Feb 17, 2020

Thanks for letting me contribute! 😄

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.

feature request: oneOf that allows you to check a value against multiple predicates
4 participants