integer validation

node v8.17.0
version: 1.0.0
endpointsharetweet
const { object, number } = require('yup') const contactSchema = object({ age: number() .integer() }) // this should be valid. note: it's a string contactSchema.validate({ age: '24' }, { strict: true }) .then(valid => console.log('valid', valid)) .catch(e => console.log(e)) // this should be invalid contactSchema.validate({ age: '24,6' }, { strict: true }) .then(valid => console.log('valid', valid)) .catch(e => console.log(e))
Loading…

no comments

    sign in to comment