1.1.1 • Published 3 years ago
nibzvln v1.1.1
Welcome to nibzvln 👋
JavaScript reusable chainable validation library
Install
yarn add nibzvln
or
npm install nibzvln
Usage
Chainable
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
Extendable
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();
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.