(data: unknown, ctx: RedactionContext, currentPath: string)
| 258 | } |
| 259 | |
| 260 | function redactValue(data: unknown, ctx: RedactionContext, currentPath: string): unknown { |
| 261 | if (data === null || data === undefined) return data |
| 262 | |
| 263 | if (typeof data === "string") { |
| 264 | return redactStringValue(data, ctx) |
| 265 | } |
| 266 | |
| 267 | if (typeof data !== "object") return data |
| 268 | |
| 269 | if (Array.isArray(data)) { |
| 270 | if (!ctx.parsed.trackPaths) { |
| 271 | return data.map((item) => redactValue(item, ctx, "")) |
| 272 | } |
| 273 | return data.map((item, i) => redactValue(item, ctx, currentPath ? `${currentPath}.${i}` : String(i))) |
| 274 | } |
| 275 | |
| 276 | return redactObject(data as Record<string, unknown>, ctx, currentPath) |
| 277 | } |
| 278 | |
| 279 | function redactObject( |
| 280 | obj: Record<string, unknown>, |
no test coverage detected