Add stuff

This commit is contained in:
2025-07-31 22:50:39 +02:00
parent 07c434dba8
commit 15f4f74cb7
18 changed files with 506 additions and 76 deletions
+32
View File
@@ -0,0 +1,32 @@
import slugify from 'slugify';
export function sluggy(object: {
name?: string | null | undefined;
title?: string | null | undefined;
id: number | string;
}) {
const { id, name, title } = object;
let string;
if (!!name && name.length > 0) {
string =
slugify(name.substring(0, 25), {
replacement: '-',
lower: true,
strict: true,
trim: true
}) + '-';
} else if (!!title && title.length > 0) {
string =
slugify(title.substring(0, 25), {
replacement: '-',
lower: true,
strict: true,
trim: true
}) + '-';
}
string += `${id}`;
return string;
}