Verification, sanitization, and type coercion for environment variables in Node.js
asRegExp
accessor (#136)accessors
property to the public API for use in building extraAccessors
(#121).editorconfig
(#129)extraAccesors
(#129)extraAccessors
args type error (#131)asUrlString()
and asUrlObject()
(#132)asUrlString()
to mention WHATWG URL behaviour (#126, #129)required()
, convertFromBase64()
, etc. with ExtensionFn
.default()
so that it correctly returns an empty string value if provided.default(value)
function.example(string)
function.default(string)
function.required()
until an accessor such as asString()
is invoked.required()
was undefined on a IPresentVariable
.Migration from 5.x to 6.0.0 should be smooth. Change any instance of
env.get(target, default)
to env.get(target).default(default)
. For example:
// Old 5.x code
const emailAddr = env.get('EMAIL_ADDR', '[email protected]').asString()
// New 6.x compatible code
const emailAddr = env.get('EMAIL_ADDR').default('[email protected]').asString()