Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

yup .oneOf

node v10.24.1
version: master
endpointsharetweet
const { string } = require("yup"); const fruits = ["banana", "apple"]; const nullable = string().oneOf(fruits).nullable(); const withNull = string().oneOf([...fruits, null]); const nullableWithNull = string().oneOf([...fruits, null]).nullable(); console.log({ nullable: await nullable.isValid(null), withNull: await withNull.isValid(null), nullableWithNull: await nullableWithNull.isValid(null) });
Loading…

no comments

    sign in to comment