Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

yup oneOf

// mixed.oneOf(arrayOfValues: Array<any>, message?: string | function): Schema Alias: equals
// Whitelist a set of values. Values added are automatically removed from any blacklist if they are in it. The ${values} interpolation can be used in the message argument.

// Note that undefined does not fail this validator, even when undefined is not included in arrayOfValues. If you don't want undefined to be a valid value, you can use mixed.required.

let schema = yup.mixed().oneOf(['jimmy', 42]);

await schema.isValid(42); // => true
await schema.isValid('jimmy'); // => true
await schema.isValid(new Date()); // => false
Comment

PREVIOUS NEXT
Code Example
Javascript :: delay / sleep program in js 
Javascript :: search filter with react native on flatlist 
Javascript :: react hooks example 
Javascript :: javaScript getDate() Method 
Javascript :: download pdf from drive js 
Javascript :: postfix date javascript 
Javascript :: delate char betwen index js 
Javascript :: react native select simulator 
Javascript :: jquery slick drag goes back 
Javascript :: react popup 
Javascript :: how to add debounce in react redux js 
Javascript :: form data to json 
Javascript :: order by type 
Javascript :: supertest expect content type 
Javascript :: compare string length javascript 
Javascript :: js .length 
Javascript :: javascript target closest class 
Javascript :: getx navigation 
Javascript :: canvas set line opacity 
Javascript :: javascript optional parameters 
Javascript :: exit node 
Javascript :: js wrap function 
Javascript :: .env file example react native 
Javascript :: axios.get Uncaught (in promise) TypeError: response.json is not a function 
Javascript :: leaflet flyto 
Javascript :: associative array add new key and value js 
Javascript :: check unique object in array javascript site:stackoverflow.com 
Javascript :: react hooks link to external site 
Javascript :: what is ... in javascript 
Javascript :: redux actions 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =