8 lines
367 B
TypeScript
8 lines
367 B
TypeScript
export function unifySlug(slug: string | string[]): string
|
|
{
|
|
return (Array.isArray(slug) ? slug.join('/') : slug);
|
|
}
|
|
export function parseId(id: string | undefined): string |undefined
|
|
{
|
|
return id?.normalize('NFD')?.replace(/[\u0300-\u036f]/g, '')?.replace(/^\d\. */g, '')?.replace(/\s/g, "-")?.replace(/%/g, "-percent")?.replace(/\?/g, "-q")?.toLowerCase();
|
|
} |