Skip to content
0

katanakit-js / useSlugify

Function: useSlugify() ​

ts
function useSlugify(text): string;

Defined in: src/core/services/generator.service.ts:143

Converts a text string into a URL-friendly slug.

Parameters ​

ParameterTypeDescription
textstringThe text to slugify. Must not be empty.

Returns ​

string

A lower-case, hyphen-separated slug with diacritics removed.

Throws ​

If text is empty or falsy.

Example ​

ts
import { useSlugify } from "katanakit-js";

useSlugify("Hello World!");      // "hello-world"
useSlugify("  Café au Lait  ");  // "cafe-au-lait"

Released under the MIT License.