10a - a value blank once cleaned counts as empty

This commit is contained in:
2026-09-25 19:37:21 +02:00
parent 3a18627389
commit 8f33f67f72
+3 -2
View File
@@ -91,15 +91,16 @@ function noteLeaves(name: string): AdfNode[] {
}
function noteName(value: unknown): string | undefined {
return typeof value === 'string' ? nonEmpty(oneLine(value).trim()) : undefined
return nonEmpty(value) === undefined ? undefined : oneLine(String(value)).trim()
}
export function oneLine(text: string): string {
return text.replace(/[\r\u0000]/g, '').replace(/\n/g, ' ')
}
// Blank once a text leaf's cleaning has run is empty.
function nonEmpty(value: unknown): string | undefined {
return typeof value === 'string' && value !== '' ? value : undefined
return typeof value === 'string' && oneLine(value).trim() !== '' ? value : undefined
}
function isoDate(timestamp: unknown): string | undefined {