Skip to content

normalize

normalize(s): string

Defined in: src/namer.ts:434

Turn arbitrary prompt text into a short, human-readable kebab-case slug. Transliterates accents, drops stopwords, then selects by specificity rather than position: the distinctive words win wherever they sit in the sentence, so prose names its subject (“export-obvious”) instead of the dull opening words a positional namer would grab (“wondering-maybe-export”). Common-but-dull words are kept only when nothing more specific survives. Keeps reading order so a multi-word subject stays contiguous, and caps at 4 words. Falls back to the raw words if the stopword filter wiped everything, and to "" if truly empty. Distinctiveness is best-effort, not guaranteed — two prompts can still reduce to the same slug; uniqueName() in service.ts suffixes any clash.

string

string