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