Closed Aqzhyi closed 3 years ago
Hi, the project joi has API validate it returns {error, value} such as:
let schema = Joi.string().empty(''); schema.validate(''); // returns { error: null, value: undefined } schema = schema.empty(); schema.validate(''); // returns { error: "value" is not allowed to be empty, value: '' }
Or .error(new Error(...))
.error(new Error(...))
const schema = Joi.string() .error(new Error('Was REALLY expecting a string')); schema.validate(3); // returns Error('Was REALLY expecting a string')
So I make API validate and createValidate it also returns {error, value}.
validate
createValidate
What do you think?
Fixes #169
@hilezir Bump
Closing for lack of response.
https://github.com/sindresorhus/ow/issues/169#issuecomment-701031535
Hi, the project joi has API validate it returns {error, value} such as:
Or
.error(new Error(...))
So I make API
validate
andcreateValidate
it also returns {error, value}.What do you think?
Fixes #169