Rhys Sullivanfmtc92c57d6 months agoHistory
20 lines · 671 B · TypeScript
RawDownload
/** * Normalizes a display name into a valid namespace identifier: lowercase * snake_case, only `[a-z0-9_]`, no leading/trailing underscores. Produces * strings that are safe to use as TypeScript/tool-name prefixes. */export function slugifyNamespace(input: string): string {  return input    .trim()    .toLowerCase()    .replace(/[^a-z0-9_]+/g, "_")    .replace(/^_+|_+$/g, "");} /** * Sanitizes namespace input as the user types without removing intentional * underscores that are still in-progress at the field boundaries. */export function normalizeNamespaceInput(input: string): string {  return input.toLowerCase().replace(/[^a-z0-9_]+/g, "_");}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t