Created the validation utility

This commit is contained in:
Mathias Wagner 2022-06-26 17:14:11 +02:00
parent 971ebce889
commit 2fd89a8dbb
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

5
util/validate.js Normal file
View 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;
}