1.0.1 • Published 7 years ago

scond v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Scond

=========

CircleCI codecov License: MIT bitHound Overall Score bitHound Dependencies contributions welcome code style: prettier

A small library that performs multi validation execution

Installation

npm i -S scond

or

yarn add scond

Usage

Simple case

const Scond = require('scond');

const scond = new Scond();

const check1 = {
  id: 'test_cond_1',
  check: values => {
    return values.user.access_level > 10
  }
};

const check2 = {
  id: 'test_cond_2',
  check: values => {
    return typeof values.user === 'object'
  }
};

const check3 = {
  id: 'test_cond_3',
  check: values => {
    return values.user.access_level > 100
  }
};

scond.addMulti([check1, check2]);

const values = {user: {
  access_level: 42
}};

scond.exec([{id: 'test_cond_2'}, {id: 'test_cond_1'}], values); //true

scond.add(check3);

scond.exec([{id: 'test_cond_2'}, {id: 'test_cond_1'}, {id: 'test_cond_3'}], values); //false

Tests

npm test or yarn test

Contributing

If you want to join this case by help maintaining something, please don't hesitate to contact.

I'm happy to receive bug reports, fixes, documentation enhancements, and any other improvements.

And since I'm not a native English speaker, if you find any grammar mistakes in the documentation, please also let me know. :)

1.0.1

7 years ago

1.0.0

7 years ago