Created the validation utility
This commit is contained in:
parent
971ebce889
commit
2fd89a8dbb
5
util/validate.js
Normal file
5
util/validate.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports.validateSchema = (schema, object) => {
|
||||||
|
const {error} = schema.validate(object, {errors: {wrap: {label: ''}}});
|
||||||
|
|
||||||
|
return error ? error.details[0].message : undefined;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user