hi5
Lightweight type checker for bros 🙌.
hi5 checks values against types, that's it, yup.
It's meant to be used for function arguments validation and avoid errors related to a lack of type checking. That's why you can guard functions to release some burden.
Install
npm install --save hi5
Usage
Simple check
{ return a + b} // => 3 // Error
Multiple types check
{ console} // => 1 // => '1' // Error
Optional arguments
{ hi5 // [...] console} // => 1 // => 1 // Error
Guard function
{ return a + b} const guardedAdd = hi5 // => 3 // Error
Tips
Guard on export
const hi5 = { return a + b} moduleexports = hi5
Rest parameters
{ args // [...]}
License
MIT © Nicolas Gryman