IsOkay Validator
Simple
const isOkay = ; const v = ; v ; v ; v ; const data = v;
Validates nested objects
const isOkay = ; const v = ; v;v; assert; assert; assert;
Reuse the validator for MongoDB updates
All root keys of input will be treated as optional.
const isOkay = ; const v = ; v;v; v; const input = {}; assert;
Objects in arrays
const isOkay = ; const v = ; v;v;v;v;v;v; v;v ;v ;v;v ;v ; assert;
API
Classes
- Rule
{Rule} Validation configurator
Typedefs
- ValidationError :
Error
- validator :
function
Validator callback
Rule
{Rule} Validation configurator
Kind: global class
- Rule
- .string() ⇒
this
- .number() ⇒
this
- .boolean() ⇒
this
- .default(defaultValue) ⇒
this
- .is(message, fn) ⇒
this
- .notEmpty() ⇒
this
- .string() ⇒
this
rule.string() ⇒ Sets filter
Kind: instance method of Rule
this
rule.number() ⇒ Sets filter
Kind: instance method of Rule
this
rule.boolean() ⇒ Sets filter
Kind: instance method of Rule
this
rule.default(defaultValue) ⇒ Sets default value
Kind: instance method of Rule
Param | Type |
---|---|
defaultValue | * |
this
rule.is(message, fn) ⇒ Adds validator
Kind: instance method of Rule
Param | Type |
---|---|
message | string |
fn | validator |
this
rule.notEmpty() ⇒ Value should not be empty (not falsey)
Kind: instance method of Rule
Error
ValidationError : Kind: global typedef
Properties
Name | Type |
---|---|
invalidKey | string |
status | number |
statusCode | number |
function
validator : Validator callback
Kind: global typedef
Param | Type | Description |
---|---|---|
value | * |
found value |
key | * |
a key, where the value was found |