Env Var Versions Save

Verification, sanitization, and type coercion for environment variables in Node.js

7.0.0

3 years ago
  • Drop support for Node.js 8 and 13 (support only current, active, and maintenance versions)
  • Improve support for browser usage (#138)
  • Fix documentation errors (#139)
  • Improve documentation layout (#140)

6.3.0

3 years ago
  • Add asRegExp accessor (#136)
  • Add better TypeScript example for custom accessors (#133)

6.2.0

4 years ago
  • Add accessors property to the public API for use in building extraAccessors (#121)
  • Add support for logging with a built-in or custom logger (#112)
  • Add Node.js v14 to CI builds
  • Add single quote rule to .editorconfig (#129)
  • Add JavaScript example for extraAccesors (#129)
  • Fix extraAccessors args type error (#131)
  • Fix types and docs for asUrlString() and asUrlObject() (#132)
  • Update README for asUrlString() to mention WHATWG URL behaviour (#126, #129)

6.1.1

4 years ago
  • Fix TS error with ExtenderTypeOptional and ExtenderType typings (#119)

6.1.0

4 years ago
  • Fix TS error with extraAccessor typings (#114)
  • Add support for generic types in asEnum (#116)

6.0.4

4 years ago
  • Fix compilation error caused by typings generic issue.

6.0.3

4 years ago
  • Fix typings to support required(), convertFromBase64(), etc. with ExtensionFn.

6.0.2

4 years ago
  • Fix default() so that it correctly returns an empty string value if provided.
  • README improvement by @joh-klein for positive/negative number parsing rules.

6.0.1

4 years ago
  • Fix typings for the default(value) function.

6.0.0

4 years ago
  • Add support for setting an example value via the example(string) function.
  • Passing default values is now performed using the default(string) function.
  • Defer checks for required() until an accessor such as asString() is invoked.
  • Fix typings issue where 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()