UNPKG

1.35 kBTypeScriptView Raw
1/**
2 * This should only be necessary when you or a package mutates the environment variables.
3 * The `mainFn` / `mainTestFn` / `mainBenchFn` / ... will call this function by default
4 * after loading your `.env` file.
5 *
6 * Accessing an environment variable via `process.env.XXXX` is relatively slow compared
7 * to direct property access. As can be seen in the following benchmark:
8 *
9 * ```txt
10 * property access 500000000 iterations 0 ns/op
11 * process.env access 5000000 iterations 246 ns/op
12 * ```
13 *
14 * See this thread: https://github.com/nodejs/node/issues/3104 for more information.
15 *
16 * @since 0.1.0
17 * @summary Repopulate the cached environment copy.
18 *
19 * @returns {void}
20 */
21export function refreshEnvironmentCache(): void;
22/**
23 * Returns true when the `NODE_ENV` variable is not set, or when it does not equal to
24 * `development`. This allows for a 'safe by default' experience.
25 *
26 * @since 0.1.0
27 *
28 * @returns {boolean}
29 */
30export function isProduction(): boolean;
31/**
32 * Returns true when `NODE_ENV` is explicitly set to 'development' or when the
33 * environment variable `IS_STAGING` is explicitly set to 'true'.
34 *
35 * @since 0.1.0
36 *
37 * @returns {boolean}
38 */
39export function isStaging(): boolean;
40/**
41 * Cached process.env
42 *
43 * @type {Record<string, string>}
44 */
45export let environment: Record<string, string>;