Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@zhaoyao91/check-env

zhaoyao9119MIT0.0.1

Check environment variables.

zhaoyao91, check-env

readme

Check Env

Check environment variables.

Install

npm i @zhaoyao91/check-env

Usage

const checkEnv = require("@zhaoyao91/check-env");

const env = checkEnv({
  SOME_ENV: {
    optional: true,                   // ?= false
    default: "some-value",            // ?= undefined
    checkIn: x => x !== "bad-value",  // ?= alwaysTrue
    map: x => x.split("-"),           // ?= identity
    checkOut: x => x.length > 1       // ?= alwaysTrue
  }

  // OTHER_ENV: ...
});

// env is {SOME_VALUE: ['some', 'value']}

License

MIT