config-validator-alpha

0.1.6 • Public • Published

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
  • email
  • "*"

Test

npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i config-validator-alpha

Weekly Downloads

2

Version

0.1.6

License

ISC

Unpacked Size

19.7 kB

Total Files

19

Last publish

Collaborators

  • volkoff