Config validator
npm install config-validator-alpha
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
* email
""
Test
`
npm run test
``