Skip to content

Helper function which ensures that required environment variables are set.

License

Notifications You must be signed in to change notification settings

bifravst/from-env

Folders and files

NameName
Last commit message
Last commit date
Nov 8, 2024
Jan 30, 2024
Jan 27, 2022
Feb 16, 2024
Jul 12, 2024
Jan 27, 2022
Apr 3, 2024
Apr 3, 2024
Jan 6, 2025
Jul 12, 2024
Nov 29, 2023
Feb 20, 2024
Feb 14, 2025
Feb 14, 2025
Apr 2, 2024
Mar 18, 2024

fromEnv npm version

GitHub Actions semantic-release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

Helper function which ensures that required environment variables are set.

Example

import { fromEnv } from "@bifravst/from-env";

const { env } = fromEnv({
  env: "MY_ENV",
})(process.env);

This will throw an exception if MY_ENV is not set on process.env. Otherwise, env will not contain the value of process.env.MY_ENV.

Installation

npm i --save-dev --save-exact @bifravst/from-env

Usage

See fromEnv.spec.ts.