-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Validate if string is part of an array .oneOf(string[])
#80
Comments
👍 Good idea |
Maybe change the name for |
Why? Enums are not the same as arrays. Can you give an example? |
for me, enum refers to the possible value that can take the string. Or I did not fully understand the use cases of "is" |
I think |
Exactly, enums are more a TS thing rather than a JS thing. |
Yes, it might be confused. "in" seems fine in this case ^^ |
Alternatively, ow(input, ow.string.oneOf(['foo', 'bar'])); |
👍 |
.in(string[])
.oneOf(string[])
I had a use case where I needed to check if the input was a string and was part of an array. So it might be nice if we had a
.in(list: string[])
predicate (or another name) which could cover this.Example
The text was updated successfully, but these errors were encountered: