Skip to content
Pipeline based data validation library
TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
src
.gitignore
LICENSE
README.md
index.js
package.json
tsconfig.json

README.md

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' ] }
You can’t perform that action at this time.