(self: Redacted.Redacted<T>)
| 5 | |
| 6 | /** @internal */ |
| 7 | export const value = <T>(self: Redacted.Redacted<T>): T => { |
| 8 | if (redactedRegistry.has(self)) { |
| 9 | return redactedRegistry.get(self) |
| 10 | } else { |
| 11 | throw new Error( |
| 12 | "Unable to get redacted value" + |
| 13 | (self.label ? ` with label: "${self.label}"` : "") |
| 14 | ) |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | /** @internal */ |
| 19 | export const stringOrRedacted = (val: string | Redacted.Redacted): string => typeof val === "string" ? val : value(val) |
no test coverage detected