Skip to content
DevFlash
FreeJunior~15 minDraft, awaiting review

Normalize and dedupe tags

A pure TypeScript function with the edge cases an interviewer will poke at.

Requirements

  • Trim and lowercase every tag.
  • Collapse inner whitespace into a single dash.
  • Drop empty entries.
  • Remove duplicates, keeping the order of first appearance.
  • Do not mutate the input.

Out of scope

  • Unicode normalization (accents stay as typed).

Hints

See the commented solutionReport a problem
Starting the editor…