abides
modern javascript object validation.
validate, default and transform data.
not production ready yet, use at own risk.
- lightweight (~1kb min+gzipped bundled)
- only 3 deps (lodash, esm and fromentries polyfill)
- non-obscure control of validation
example
// => { ok: true, errors: [], self: { error: '' }, result: 5 }/* => { ok: false, self: { error: 'is '5' but should be of type Number' }, errors: ['is '5' but should be of type Number'], result: '5'} */// => { ok: true, errors: [], self: { error: null }, result: 5 }
more examples
install
yarn add abides
or npm
npm i --save abides
planned changes
- validator caching
- async support
- web forms ready errors
- typescript implementation
requirements
- ES2017 (as in, node 8, a modern browser or a babel like library)
other docs
open to contributions
help is needed in:
- typescript definition and type check tests.