options = ['asdasda', 'asdasdas', 'asdasdasafsaafasfasfasfasfasfasasasasasdas', 'asd'];
req.check('options', 'Option must not exceed 30 characters').isLength({max: 30});
Am trying to validate each string in the array options. Is there any way to do it?
是的,您必须为此使用通配符。
req.check('options.*').isLength({ max: 30 })
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.