Open tonyxiao opened 7 years ago
use the 'typeof' operator, if it is not a string you can push an error on to the errors array (create one if it does not exist) which is on the context.
should look similar to this
if (typeof someValue !== 'string'){ context.errors = context.errors || [] context.errors.push({notString:
Field must be a string!}) }
I see. I would have expected / hoped for something built in for this. But ok :)
+1 for isString() validator
how do you check a body parameter is actually string, rather than number or null or object?