import joi from '@hapi/joi'; export default class NoteFieldValidate { private static note_field = { name: joi.string() .max(128), qty: joi.number() }; static output (data) { const {value, error} = joi.object({ name: this.note_field.name, qty: this.note_field.qty }).validate(data, {stripUnknown: true}); return error !== undefined? null : value; } }