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

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -