[READ-ONLY] Mirror of https://github.com/flo-bit/skywatched. review movies and tv shows, based on at proto
skywatched.app
477 B
16 lines
1import { type ClassValue, clsx } from 'clsx';
2import { twMerge } from 'tailwind-merge';
3
4export function cn(...inputs: ClassValue[]) {
5 return twMerge(clsx(inputs));
6}
7
8export function nameToId(name: string) {
9 // replace spaces with hyphens, non-alphanumeric characters with empty string, replace multiple hyphens with a single hyphen, max length 100
10 return name
11 .toLowerCase()
12 .replace(/ /g, '-')
13 .replace(/[^a-z0-9-]/g, '')
14 .replace(/-+/g, '-')
15 .slice(0, 100);
16}