( data: Record<string, unknown> | undefined )
| 368 | * @returns Normalized data object |
| 369 | */ |
| 370 | export function normalizeBlockData( |
| 371 | data: Record<string, unknown> | undefined |
| 372 | ): Record<string, unknown> { |
| 373 | const normalized: Record<string, unknown> = {} |
| 374 | |
| 375 | for (const [key, value] of Object.entries(data || {})) { |
| 376 | // Skip excluded fields |
| 377 | if (EXCLUDED_BLOCK_DATA_FIELDS.includes(key)) continue |
| 378 | // Skip empty/null/undefined values (treat as equivalent to missing) |
| 379 | if (!isNonEmptyValue(value)) continue |
| 380 | |
| 381 | normalized[key] = value |
| 382 | } |
| 383 | |
| 384 | return normalized |
| 385 | } |
| 386 | |
| 387 | /** |
| 388 | * Extracts block fields for comparison, excluding visual-only and runtime fields. |
no test coverage detected