validate-easy
v0.4.0
Published
Validate your data easy with pipeline style.
Downloads
4
Maintainers
Readme
Validate easy
(wip) Validate your data easy with pipeline style.
Install
npm install validate-easy
Usage
import _ from 'lodash';
import v from 'validate-easy';
const data = v.assert(
v.hasProps('foo', 'bar', 'baz'),
v.path('foo')(v.isNumber, v.lt(10), v.gt(0)),
v.path('bar')(_.trim, Number, v.isInt)
)({
foo: 5,
bar: ' 4',
baz: null
})
console.log(data);
// result
// {
// foo: 5,
// bar: 4,
// baz: null
// }
TODO
- [x] pipe function
- [ ] build for node and browser
- [ ] async validator