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

proposal: is.allNot/is.none interface #295

Open
bbusschots-mu opened this issue Sep 6, 2018 · 4 comments
Open

proposal: is.allNot/is.none interface #295

bbusschots-mu opened this issue Sep 6, 2018 · 4 comments

Comments

@bbusschots-mu
Copy link

is.any and is.all are great, but I often find myself needing to make sure that an array does not contain any of something:

is.allNot.string(false, 42, new Date()); // true
is.allNot.string(false, 42, 'today'); // false

If it would be accepted I'd be happy to the code and issue a pull request.

@ironmaniiith
Copy link
Collaborator

That's exact negation of is.any. You can always use !is.any(...) for this purpose

@bbusschots-mu
Copy link
Author

@ironmaniiith yes, but one of the big advantages if is.js is that it allows clear more human-friendly syntax.

You can say !is.string(), but the library right pushes you to the much clearer is.not.string(). Having to write !is.any() is a failure of that model that could be very easily fixed by adding a human-friendly interface.

@ironmaniiith
Copy link
Collaborator

ironmaniiith commented Sep 7, 2018

True. I'm not saying we should not have this functionality. Just saying how it can be accomplished for now. Having this functionality in is.js might be a good thing I guess

@ouroborus
Copy link

If is.js is going to have not (as it does), it should work with any and all. The syntax should be either is.not.any, is.any.not, or both, but definitely not is.anyNot.

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

3 participants