vtypes
v1.0.0
Published
Runtime type checking for objects using validate.js
Downloads
11
Maintainers
Readme
vtypes
Additional validation rules / contraints for validate.js to address other common data patterns
About
vtypes
is built on top of validate.js
, providing additional validation rules for
certain data patterns / data types.
See the package repository for more details.
Build Formats
i.e.
# install validate.js
$ npm install validate.js
# and install one of the following:
$ npm install vtypes
$ npm install vtypes-register
$ npm install vtypes-* # where * corresponds to a validator type
Usage
// export of all vtype validators without registering
const vtypes = require('vtypes');
const validate = require('validate.js');
// you can then proceed to register the required validators.
validate.validators.array = vtypes.array;
// or everything
validate.extend(validate.validators, vtypes);
// start using the validators
Alternatively, using vtypes-register
:
// import the register file to include all available validators.
require('vtypes-register')();
const validate = require('validate.js');
// start using the validators
Validators
For the most updated validators and their information, please see the package repository for more details.
- arrayOf
- array
- bool
- different
- func
- immutable
- invariant
- json
- objectOf
- only
- requiredIf
- requiredUnless
- requiredWithAll
- requiredWith
- requiredWithoutAll
- requiredWithout
- shape
- size
- string
License
vtypes
is MIT licensed