task-5: normalizeStatus() 状态归一(大写化、连字符/空格转下划线、空值安全)
This commit is contained in:
@@ -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, '_')
|
||||
}
|
||||
Reference in New Issue
Block a user