Skip to content

slugify

Converts a string into a URL-friendly slug.

Available since v2.0.0

import { slugify } from '@helpers4/string';
slugify(str: string): string
ParameterTypeDescription
strstringThe string to convert into a slug.

string — A lowercase, hyphen-separated slug safe for URLs.

Converts a string into a lowercase, hyphen-separated slug.

slugify('Hello World!')
// => 'hello-world'

Normalizes Unicode characters and strips diacritics.

slugify('Crème brûlée')
// => 'creme-brulee'

View source on GitHub