diff --git a/util/validate.js b/util/validate.js new file mode 100644 index 0000000..0e3a293 --- /dev/null +++ b/util/validate.js @@ -0,0 +1,5 @@ +module.exports.validateSchema = (schema, object) => { + const {error} = schema.validate(object, {errors: {wrap: {label: ''}}}); + + return error ? error.details[0].message : undefined; +} \ No newline at end of file