@azizbecha/strkit
Version:
strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.
12 lines (11 loc) • 302 B
TypeScript
/**
* Converts a string to a URL-friendly slug.
*
* @param str - The string to convert to slug
* @returns A URL-friendly slug string
*
* @example
* toSlug('Hello World!'); // "hello-world"
* toSlug('This is a TEST'); // "this-is-a-test"
*/
export default function toSlug(str: string): string;