UNPKG

@puq/names

Version:

The library provides a useful function to create all casing variants of a given string value such as title-case, pascal-case, snake-case and so more.

11 lines (10 loc) 385 B
import { normalizeName } from './normalize-name.js'; /** * Replace all special chracters with dash and lowercase * @param value string * @returns slug string that only contains lowercase letters and dash */ export function slugify(value) { value = value.replace(/[^a-zA-Z _-]/g, ' '); return normalizeName(value).split(' ').join('-'); } //# sourceMappingURL=slugify.js.map