Pale: A dead-simple schema validator.
Instalation
You can install Pale via npm:
npm install --save pale
Or use it directly in browser via cdn service:
https://unpkg.com/pale/build/pale.min.js
Usage
; const check = name: 'string minLength(2)' 'John Doe' age: 'number minLength(1) maxLength(3)' '35'; check // Object with input data ; // Object showing which validator failed
Adding a new validator
; const check = acceptedTerms: 'boolean' true; { if 'true' 'false' true false return true; else return false; } check; check; // ...
Get all available validators
; const check = acceptedTerms: 'boolean' true; Object;// Outputs by default:// ['string', 'number', 'min', 'max', 'minLength', 'maxLength']
Credits & Thanks
By @Kazzkiq
Pale was made possible by awesome open-source projects such as Rollup.