JavaScript reusable chainable validation library
yarn add nibzvln
or
npm install nibzvln
nibzvln().numeric().minLength(3).validate("123"); // true
nibzvln().not().numeric().minLength(3).validate("hello"); // true
nibzvln().numeric().minLength(3).validate("hello"); // false
nibzvln().minLength(3).not().email().validate("hello"); // true
nibzvln().not().minLength(45).email().validate("example@example.com"); // true
You can create your own custom validation rules
const customRules = {
foo: () => (text) => text === "bar";
}
nibzvln.defineCustomRules(customRules);
And you can use them like built-in ones
nibzvln().minLength(3).foo().validate("bar"); // true
You can also remove custom validation rules that are created
nibzvln.clearCustomRules();
Contributions, issues and feature requests are welcome!
Feel free to check issues page.