(rawValue: unknown)
| 62 | } |
| 63 | |
| 64 | export function normalizeDependencyValue(rawValue: unknown): unknown { |
| 65 | if (rawValue === null || rawValue === undefined) return null |
| 66 | |
| 67 | if (typeof rawValue === 'object') { |
| 68 | if (Array.isArray(rawValue)) { |
| 69 | if (rawValue.length === 0) return null |
| 70 | return rawValue.map((item) => normalizeDependencyValue(item)) |
| 71 | } |
| 72 | |
| 73 | const record = rawValue as Record<string, unknown> |
| 74 | if ('value' in record) return normalizeDependencyValue(record.value) |
| 75 | if ('id' in record) return record.id |
| 76 | |
| 77 | return record |
| 78 | } |
| 79 | |
| 80 | return rawValue |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Build a flat map of subblock values keyed by subblock id. |
no outgoing calls
no test coverage detected