1.0.1 • Published 4 years ago

nibzvl v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Welcome to nibzvl 👋

Version License: MIT

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.

1.0.1

4 years ago

1.0.0

4 years ago