( value: unknown, options: NormalizeStructuredEnvelopeOptions, path: string[] = [], )
| 408 | } |
| 409 | |
| 410 | function normalizeValue( |
| 411 | value: unknown, |
| 412 | options: NormalizeStructuredEnvelopeOptions, |
| 413 | path: string[] = [], |
| 414 | ): unknown { |
| 415 | const key = path.at(-1); |
| 416 | |
| 417 | if (typeof value === 'string') { |
| 418 | return normalizeString(value, options, key, path); |
| 419 | } |
| 420 | |
| 421 | if (typeof value === 'boolean') { |
| 422 | return normalizeBoolean(path, key, value); |
| 423 | } |
| 424 | |
| 425 | if (typeof value === 'number') { |
| 426 | return normalizeNumber(path, key, value); |
| 427 | } |
| 428 | |
| 429 | if (Array.isArray(value)) { |
| 430 | const normalized = value.map((item, index) => |
| 431 | normalizeValue(item, options, [...path, String(index)]), |
| 432 | ); |
| 433 | if (key === 'testCases') { |
| 434 | return normalizeTestCases(normalized); |
| 435 | } |
| 436 | if (key === 'testFailures') { |
| 437 | return normalizeDiagnosticTestFailures(normalized); |
| 438 | } |
| 439 | if (key === 'stderr') { |
| 440 | return normalizeStderrLines(normalized); |
| 441 | } |
| 442 | if (key === 'frames' && path.includes('threads')) { |
| 443 | return normalizeDebugStackFrames(normalized); |
| 444 | } |
| 445 | return normalized; |
| 446 | } |
| 447 | |
| 448 | if (isRecord(value)) { |
| 449 | const isBuildSetting = isBuildSettingsEntry(value, path); |
| 450 | const normalizedEntries = Object.entries(value).map(([entryKey, entryValue]) => { |
| 451 | if (isBuildSetting && entryKey === 'key') { |
| 452 | return [entryKey, normalizeBuildSettingsEntryKey(String(entryValue))]; |
| 453 | } |
| 454 | |
| 455 | if (isBuildSetting && entryKey === 'value') { |
| 456 | return [ |
| 457 | entryKey, |
| 458 | normalizeBuildSettingsEntryValue(String(value.key), String(value.value), options), |
| 459 | ]; |
| 460 | } |
| 461 | |
| 462 | return [entryKey, normalizeValue(entryValue, options, [...path, entryKey])]; |
| 463 | }); |
| 464 | |
| 465 | return normalizeSpringBoardHomeCompactCapture( |
| 466 | normalizeDebugStackFrame(Object.fromEntries(normalizedEntries), path), |
| 467 | ); |
no test coverage detected