1.0.6 • Published 5 years ago

valpiper v1.0.6

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
5 years ago

Valpiper

Pipeline based data validation library

Valpiper was originally made to make serial data validations (request body => token => request data) easier and more compact.

Installation

NPM: npm i --save valpiper Yarn: yarn add valpiper

The valpiper package also contains type definition file, so you don't need to additionally install @types-package.

Usage example

const  Valpiper  =  require('valpiper').Valpiper;
const  vp  =  new  Valpiper();

vp.add('a > b', data  =>  data.a  >  data.b);
vp.add('ab', data  =>  data.a  *  data.b  <  100);


// Set data and sequence of tests:

console.log(vp.test({a:  8, b:  5}, 'a > b', 'ab'));
// { passed: true, results: [ 'a > b', 'ab' ] }
// Returned object contains status of validation success and array of passed tests.

console.log(vp.test({a:  100, b:  5}, 'a > b', 'ab'));
// { passed: false, results: [ 'a > b' ] }
1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago