MCPcopy Create free account
hub / github.com/DaKheera47/job-ops / normalizeStringArray

Function normalizeStringArray

shared/src/normalize-string-array.ts:1–21  ·  view source on GitHub ↗
(
  values: readonly string[] | null | undefined,
)

Source from the content-addressed store, hash-verified

1export function normalizeStringArray(
2 values: readonly string[] | null | undefined,
3): string[] {
4 if (!values || values.length === 0) return [];
5
6 const seen = new Set<string>();
7 const normalized: string[] = [];
8
9 for (const value of values) {
10 const trimmed = value.trim();
11 if (!trimmed) continue;
12
13 const key = trimmed.toLowerCase();
14 if (seen.has(key)) continue;
15
16 seen.add(key);
17 normalized.push(trimmed);
18 }
19
20 return normalized;
21}

Callers 5

onSaveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected