UNPKG

@tricoteuses/senat

Version:

Handle French Sénat's open data

27 lines (23 loc) 509 B
import originalSlugify from "slug" const slugifyCharmap = { ...originalSlugify.defaults.charmap, "'": " ", "@": " ", ".": " ", "-": "_", } interface Options { charmap: { [c: string]: string } mode: string replacement?: string } export function slugify(string: string, replacement?: string): string { const options: Options = { charmap: slugifyCharmap, mode: "rfc3986", } if (replacement) { options.replacement = replacement } return originalSlugify(string, options) }