avali
Arguments validation
THIS PACKAGE IS NO LONGER MAINTAINED
Install
$ npm install --save avali
Usage
const avali = require('avali');
function something(a, b) {
avali(['str', 'arr, undef'], arguments);
// ...
}
API
avali(rules, args)
rules
Type: array
Each argument is an array element, which is a string with the valid types listed, separated by commas.
rule | description |
---|---|
any | any type |
str | string |
num | number |
bool | boolean |
func | function |
arr | array |
err | error |
nil | null |
undef | undefined |
obj | object |
args | arguments |
If necessary, set the optional parameter, use undef
in together with other types.
args
Type: arguments
or array