( widths: ReadonlyArray<number | null> | undefined )
| 238 | /** Serialize per-column widths to a `<!-- zen:cols=… -->` line, or null when no |
| 239 | * column has an explicit width (so an un-resized table emits no comment). */ |
| 240 | export function serializeColWidthsComment( |
| 241 | widths: ReadonlyArray<number | null> | undefined |
| 242 | ): string | null { |
| 243 | if (!widths || !widths.some((w) => typeof w === 'number' && w > 0)) return null |
| 244 | const parts = widths.map((w) => (typeof w === 'number' && w > 0 ? String(Math.round(w)) : 'auto')) |
| 245 | return `<!-- zen:cols=${parts.join(',')} -->` |
| 246 | } |
| 247 | |
| 248 | // --------------------------------------------------------------------------- |
| 249 | // Structural operations — all return a new table, never mutate the input. |
no outgoing calls
no test coverage detected