MCPcopy Create free account
hub / github.com/KunMoe/kun-touchgal-next / normalizeStringArray

Function normalizeStringArray

utils/normalizeStringArray.ts:1–12  ·  view source on GitHub ↗
(values: readonly unknown[])

Source from the content-addressed store, hash-verified

1export const normalizeStringArray = (values: readonly unknown[]): string[] => {
2 const normalizedValues = values.flatMap((value) => {
3 if (typeof value !== 'string') {
4 return []
5 }
6
7 const normalizedValue = value.trim()
8 return normalizedValue ? [normalizedValue] : []
9 })
10
11 return [...new Set(normalizedValues)]
12}
13
14export const parseCommaSeparatedStringArray = (value: string): string[] => {
15 return normalizeStringArray(value.split(/[,,]/))

Callers 8

parseTagsFunction · 0.90
handleFetchFunction · 0.90
BatchTagFunction · 0.90
handleSubmitFunction · 0.90
parseTagsFunction · 0.90
handleFetchFunction · 0.90
checkStringArrayValidFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected