streamarr/src/utilities.ts
2025-04-03 17:27:35 +02:00

15 lines
No EOL
387 B
TypeScript

export const splitAt = (subject: string, index: number): readonly [string, string] => {
if (index < 0) {
return [subject, ''];
}
if (index > subject.length) {
return [subject, ''];
}
return [subject.slice(0, index), subject.slice(index + 1)];
};
export const toSlug = (subject: string) => {
return subject.toLowerCase().replaceAll(' ', '-');
};