Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

utils.ts

23 lines831 Bytes

1import { CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts";
2import { type CxOptions, cx } from "class-variance-authority";
3import { twMerge } from "tailwind-merge";
4​
5export function cn(...inputs: CxOptions) {
6 return twMerge(cx(inputs));
7}
8​
9export function isMacPlatform(platform: string): boolean {
10 return /mac|iphone|ipad|ipod/i.test(platform);
12​
13export function isWindowsPlatform(platform: string): boolean {
14 return /^win(dows)?/i.test(platform);
16​
17export const newCommandId = (): CommandId => CommandId.makeUnsafe(crypto.randomUUID());
18​
19export const newProjectId = (): ProjectId => ProjectId.makeUnsafe(crypto.randomUUID());
20​
21export const newThreadId = (): ThreadId => ThreadId.makeUnsafe(crypto.randomUUID());
22​
23export const newMessageId = (): MessageId => MessageId.makeUnsafe(crypto.randomUUID());