xxxxxxxxxx
const yup = require('yup');
let schema = yup.number().transform(function (value, originalValue) {
return originalValue === '' ? null : value;
});
schema.nullable().validate('abc').then(value => console.log('value', value)).catch(err => console.log('err', err))
xxxxxxxxxx
sign in to comment