redact-env
Version:
Redact values of critical environment variables in a string
18 lines (16 loc) • 658 B
TypeScript
/**
* Build a RegExp matching the values of secure environment variables.
*
* @param secureEnv A list of environment variable names to redact
* @param env Where to read the values from (defaults to process.env)
*/
declare function build(secureEnv: string[], env?: NodeJS.ProcessEnv): RegExp;
/**
* Redact a string based on a built RegExp (from redactEnv.build).
*
* @param input The input string to redact
* @param regexp A RegExp built by redactEnv.build
* @param replace What to replace redacted text with (defaults to '\[secure\]')
*/
declare function redact(input: string, regexp: RegExp, replace?: string): string;
export { build, redact };