task-5: normalizeStatus() 状态归一(大写化、连字符/空格转下划线、空值安全)

This commit is contained in:
2026-08-31 19:19:33 +08:00
parent 9f58350b4a
commit 432b2c52b2
2 changed files with 50 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
export function normalizeStatus(raw: string | null | undefined): string {
if (typeof raw !== 'string') {
return ''
}
const trimmed = raw.trim()
if (!trimmed) {
return ''
}
return trimmed.toUpperCase().replace(/[\s-]+/g, '_')
}