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: Predicate function #34

Open
timonson opened this issue Dec 31, 2020 · 0 comments
Open

Proposal: Predicate function #34

timonson opened this issue Dec 31, 2020 · 0 comments

Comments

@timonson
Copy link

timonson commented Dec 31, 2020

Hi guys, I love your project but I miss a simple predicate function. For example something like this:

export const isValid = (result: Validity): boolean => {
  return result === undefined || (result as OptionalValidity).noContext
};

I am not sure what (result as OptionalValidity).noContext does but I adapted it from assertValid.

It would make it easier to validate values, e.g.:

if (isValid(isEmail("[email protected]"))) {
...
}

Would you mind adding something like this?

Thank you and Happy New Year!

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

1 participant