renovate/lib/util/sanitize.ts
renovate[bot] 4f59b62da4
chore(deps): update dependency prettier to v2 (#5952)
* chore(deps): update dependency prettier to v2

* Run prettier-fix

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2020-04-12 18:09:36 +02:00

22 lines
434 B
TypeScript

const secrets = new Set<string>();
export function sanitize(input: string): string {
if (!input) {
return input;
}
let output: string = input;
secrets.forEach((secret) => {
while (output.includes(secret)) {
output = output.replace(secret, '**redacted**');
}
});
return output;
}
export function add(secret: string): void {
secrets.add(secret);
}
export function clear(): void {
secrets.clear();
}