This commit is contained in:
2026-05-13 19:58:16 +03:00
commit f5adeb292b
78 changed files with 12024 additions and 0 deletions

21
lib/factory/validate.js Normal file
View File

@@ -0,0 +1,21 @@
const Joi = require('joi')
module.exports = function (schema, props) {
//
// Validate and remove unknown keys
//
var {error, value} = Joi.validate(props, schema, {
presence: 'required',
stripUnknown: true
})
//
// Throw validation errors
//
if (error) {
throw error
}
//
// Return the value
//
return value
}