javascript - hapi joi filter valid value -
is there way same
var item = new item(request.payload); item.tags = _.map(item.tags, function(s){ return s.trim().tolowercase(); });
in validation code ?
var joi = require('joi'), tags = joi.array().min(1).max(3).unique().required(); exports.create = { payload: { tags: tags } };
this validation schema should work:
joi.array().items(joi.string().trim().lowercase()).unique().min(1).max(3).required();
Comments
Post a Comment