UNPKG

explicit

Version:

System to explicitly specify the way a method works.

12 lines (9 loc) 202 B
'use strict' const Joi = require('@hapi/joi') module.exports = schema => data => { const result = Joi.validate(data, schema) if (result.error) { throw result.error } return result.value }