0.10.2 • Published 6 years ago

valur v0.10.2

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
6 years ago

Valur(@npm) is an advanced declarative value validator.


Installation:

$ npm install valur --save

Usage:

(see #18)

To validate a value before its use, just preform validation a couple of lines before.

const root = (radicand: number, degree: number): number =>
    radicand ** degree ** -1;

root(8, 3);
// 2 (no error)

root(-8, 3);
// NaN (no error, but should be)

// ***

const rootValidated = (radicand: number, degree: number): number => {
    // roots of negative numbers do not make sense in JavaScript
    // therefore radicand cannot be negative
    valur(radicand, "radicand").as({ spectrum: "non-negative" });

    return root(radicand, degree);
};

rootValidated(-8, 3);
// Error: Validation failed: radicand is a negative number: value <number> -8, validator "spectrum"
0.10.2

6 years ago

0.10.1

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago