config-validator-alpha
v0.1.6
Published
Config validator
Downloads
2
Readme
Config validator
Methods
validateAndCreateDefault(config, schema, location, options);
validate(config, schema, options)
Define
{
"element": "string"
}
OR
{
"element": {
"type": "string",
"required": false, // one of optional and required
"optional": true, // one of optional and required
"values": ["example1", "example2"],
"default": "example1"
}
}
Options
logger - function or null. Default: console.err(). strictMode - return error or log error. Default: true. requiredDefault - values are required if not opnional. coercion - true / false. Type coercion. Default: true. updateAfterCoercion - true / false. Type coercion. Default: false.
Types
- number
- boolean
- string
- symbol
- object
- bigint
- url
- array
- integer
- "*"
Test
npm run test