Skip to content
HomePagesHomePages template kit

normalizeSelectKey

The stored form of a user-created select value: trimmed, lower-cased, every run of whitespace collapsed to a single `-`.

The stored form of a user-created select value: trimmed, lower-cased, every run of whitespace collapsed to a single -. Case and spacing only — punctuation is left alone. Idempotent, which is what makes normalizeSelectKey(k) === k a usable stability check on an authored key.

Import from @homepages/template-kit.

function normalizeSelectKey(text: string): string
Name Type Required Description
text string required

string