core/app/lib/utils.ts

14 lines
404 B
TypeScript

import type { ClassValue } from "clsx"
import { clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function valueUpdater<T>(updaterOrValue: T | ((old: T) => T), ref: { value: T }) {
ref.value = typeof updaterOrValue === 'function'
? (updaterOrValue as (old: T) => T)(ref.value)
: updaterOrValue
}