danneu / koa-bouncer

⛔ an http param validator for koa apps
62 stars 12 forks source link

add `notEq` #13

Closed varHarrie closed 7 years ago

varHarrie commented 7 years ago

add notEq to ensure val !== otherVal

BTW, is there any way to simplify that:

// ensures `name` is a significative string, not empty and not  space characters
// '' ==> false
// '    ' ==> false
ctx.validateBody('name').isString().trim().notEq('')
danneu commented 7 years ago

@varHarrie Good idea.

I'm not sure how it could be shortened.

varHarrie commented 7 years ago

@danneu I mean we can add notEmpty to do that, and I think add custom validator for myself is a good choice.