MCPcopy Create free account
hub / github.com/chainjet/platform / slugify

Function slugify

libs/common/src/utils/string.utils.ts:6–13  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

4export const capitalize = (str: string): string => str.charAt(0).toUpperCase() + str.substr(1)
5
6export function slugify(str: string): string {
7 return str
8 .toLowerCase()
9 .replace(/-/g, ' ')
10 .replace(/[^\w\s]/g, ' ')
11 .trim()
12 .replace(/\s+/g, '-')
13}
14
15/**
16 * camelCase to kebab-case

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected