Skip to content

Function: parseList()

parseList(raw, transform?): string[]

Normalize a config list that may arrive as an array or as a single comma/whitespace-separated string: split, apply transform, drop empties, and de-duplicate (first occurrence wins).

This is the shape every allow-list / fallback-order setting in this repo takes, because the same value can come from typed config (string[]) or from an environment variable ("a, b c"). Pass transform to normalize entries as they are read; it defaults to trimming.

string | readonly string[] | null | undefined

(entry) => string

string[]

parseList("docs.example.com, *.databricks.com");
parseList(process.env.MODEL_FALLBACKS);
parseList(raw, normalizeUrlPattern);