1.1.2 • Published 4 years ago
abides v1.1.2
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
import { abides, ofType, numberCoerce } from 'abides'
abides(5, ofType(Number))
// => { ok: true, errors: [], self: { error: '' }, result: 5 }
abides('5', ofType(Number))
/* => {
ok: false,
self: { error: 'is '5' but should be of type Number' },
errors: ['is '5' but should be of type Number'],
result: '5'
} */
abides('5', [numberCoerce, ofType(Number)])
// => { ok: true, errors: [], self: { error: null }, result: 5 }
more examples
install
yarn add abides
or npmnpm 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.
2.0.0-3
4 years ago
2.0.0-2
4 years ago
2.0.0-1
4 years ago
2.0.0-0
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.0
4 years ago
0.7.2
5 years ago
0.7.1
5 years ago
0.7.0
5 years ago
0.6.4
5 years ago
0.6.3
5 years ago
0.6.2
5 years ago
0.6.1
5 years ago
0.6.0
5 years ago
0.5.0
5 years ago
0.4.0
5 years ago
0.3.0
5 years ago
0.1.0
5 years ago
0.2.0
5 years ago