validate-easy

0.4.0 • Public • Published

Build Status Coverage Status

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

Package Sidebar

Install

npm i validate-easy

Weekly Downloads

5

Version

0.4.0

License

ISC

Unpacked Size

84 kB

Total Files

9

Last publish

Collaborators

  • wmzy