legitimate
Functional, modular and async validation 👌
Works fine on browser and node.js, framework agnostic.
Docs
Demo
Installation
npm install --save legitimate
or
yarn add legitimate
Usage
Simply:
; const legitimate = ; legitimate //validates single prop ;
Some customization:
; const legitimate = ...locales `Custom message : `; password : null; const passwordRules = password : validatorsisText validatorsnotEmpty validators validators validators validators ; legitimate //validates all the state at once //will return results for all the rules ;
ES5 & CommonJS
If you are old-school, it's fine with ES5 as well.
var Legitimate = Legitimate;var legitimate = ;
Development
start demo
npm start
or
yarn start
build
npm run build
or
yarn build
test
npm test
or
npm test -- --coverage
or
yarn test
version & publish
For versioning you can use npm version command with semver
It will also
- test
- build
- generate docs
- stage
- commit
- push the tags to tracked remote repository
- push the demo
- if CI will pass also get deployed to NPM
npm version patch -f -m "Backwards-compatible bug fixes";
or
npm version minor -f -m "Backwards-compatible new functionality";
or
yarn version major -f -m "Made incompatible API changes";
TODO
- Implement / experiment observable approach
- Simplify demo
- Add more built-in validators maybe by using other proven libraries