Created
October 23, 2018 16:42
-
-
Save snekse/7a0daa3f5c91f604a749d7ff6490a34f to your computer and use it in GitHub Desktop.
Testing for a String to just be defined in Yup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://runkit.com/snekse/yup-tests-string-defined | |
yup.string().min(0).strict(true).nullable(true).notOneOf([undefined]); | |
// If we want to allow nulls, just add `.nullable(true)` | |
const schema = yup.string().min(0).strict(true).nullable(true).notOneOf([undefined]); | |
console.log(schema.isValidSync("")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment