SHARE
TWEET

Untitled

a guest Jun 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { string, date, array, object } from 'yup';
  2.  
  3. const schema = object().shape({
  4.   name: string().required(),
  5.   email: string().email().lowercase().required(),
  6.   dateOfBirth: date().required().max(new Date(2000, 1, 1)),
  7.   knownLanguages: array().of(string()).min(1).max(3, 'Really ? Only 3 are enough'),
  8.   skills: object().shape({
  9.     personal: array().of(string()).min(1).required(),
  10.     professional: array().of(string()).min(1).required(),
  11.   }),
  12. });
  13.  
  14. await schema.validate(user);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top