vlds
v1.0.4
Published
Type validator
Downloads
1
Readme
Valids
A type validator
Example
Create a number type validator
const NumberValidator = obj =>
typeof obj === 'number'
|| obj instanceof Number
|| !isNaN(obj);
const Num = require("vlds").type(NumberValidator);
// Validate an object
const one = new Num(1);
console.log(one); // 1