🤖 Merge PR #52543 update(dotenv-parse-variables): v2 update by @peterblazejewicz

- new `ingoreFunctions` option
- version bump
- tests amended

https://github.com/niftylettuce/dotenv-parse-variables/compare/v0.2.3...v2.0.0

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2021-04-26 22:54:16 +02:00
committed by GitHub
parent c38c576631
commit 2392033d97
2 changed files with 19 additions and 7 deletions

View File

@@ -1,9 +1,9 @@
import dotenvParseVariables = require('dotenv-parse-variables');
import dotenvParseVariables = require("dotenv-parse-variables");
dotenvParseVariables({ a: 'b' });
dotenvParseVariables({ a: "b" });
dotenvParseVariables({ c: 'd', e: 'f' }, { assignToProcessEnv: true });
dotenvParseVariables({ c: "d", e: "f" }, { assignToProcessEnv: true });
dotenvParseVariables({ g: 'h' }, { overrideProcessEnv: false });
dotenvParseVariables({ g: "h" }, { overrideProcessEnv: false });
dotenvParseVariables({ i: 'j' }, { assignToProcessEnv: false, overrideProcessEnv: true });
dotenvParseVariables({ i: "j" }, { assignToProcessEnv: false, overrideProcessEnv: true, ignoreFunctions: false });

View File

@@ -1,15 +1,27 @@
// Type definitions for dotenv-parse-variables 0.2
// Type definitions for dotenv-parse-variables 2.0
// Project: https://github.com/niftylettuce/dotenv-parse-variables
// Definitions by: Gary King <https://github.com/garyking>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.0
declare namespace dotenvParseVariables {
type Parsed = Record<string, string>;
interface Options {
/**
* whether or not to assign the parsed values to `process.env`
* @default true
*/
assignToProcessEnv?: boolean;
/**
* whether or not to override existing values in `process.env`
* @default false
*/
overrideProcessEnv?: boolean;
/**
* whether or not to ignore functions in the parsed values returned
* @default true
*/
ignoreFunctions?: boolean;
}
type ParsedVariables = Record<string, unknown>;