refactor: extract parseClassList to shared utils
This commit is contained in:
10
static/utils.ts
Normal file
10
static/utils.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export const parseClassList = (value: string | null): string[] => {
|
||||
if (!value) {
|
||||
return []
|
||||
}
|
||||
|
||||
return value
|
||||
.split(' ')
|
||||
.map((entry: string): string => entry.trim())
|
||||
.filter((entry: string): boolean => entry.length > 0)
|
||||
}
|
||||
Reference in New Issue
Block a user