Something went wrong. Try again.
Highly ambitious ATProtocol AppView service and sdks forked from slices.network/slices
Something went wrong. Try again.
123456789101112131415161718/** * Convert a string to kebab-case (dash-separated lowercase) * * Examples: * "MyProject" -> "my-project" * "my_project" -> "my-project" * "My Cool Project" -> "my-cool-project" * "myProject123" -> "my-project123" */export function dasherize(str: string): string { return str .replace(/([a-z])([A-Z])/g, '$1-$2') // camelCase to kebab-case .replace(/[\s_]+/g, '-') // spaces and underscores to dashes .replace(/[^a-z0-9-]/gi, '') // remove invalid characters .replace(/-+/g, '-') // collapse multiple dashes .replace(/^-|-$/g, '') // trim dashes from start/end .toLowerCase();}