(text: string, secretValues: string[])
| 88 | } |
| 89 | |
| 90 | export function redactString(text: string, secretValues: string[]): string { |
| 91 | let out = text; |
| 92 | for (const secret of secretValues) { |
| 93 | for (const candidate of redactionCandidates(secret)) { |
| 94 | if (candidate) out = out.split(candidate).join("[redacted]"); |
| 95 | } |
| 96 | } |
| 97 | return out; |
| 98 | } |
| 99 | |
| 100 | function redactionCandidates(secret: string): string[] { |
| 101 | const candidates = new Set([secret]); |
no test coverage detected