mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
17 lines
469 B
TypeScript
17 lines
469 B
TypeScript
import { clsx, type ClassValue } from 'clsx'
|
|
import { twMerge } from 'tailwind-merge'
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export function debounce<T extends (...args: any[]) => void>(
|
|
func: T,
|
|
delay: number
|
|
): T {
|
|
let timeoutId: ReturnType<typeof setTimeout>
|
|
return function (this: any, ...args: Parameters<T>) {
|
|
clearTimeout(timeoutId)
|
|
timeoutId = setTimeout(() => func.apply(this, args), delay)
|
|
} as T
|
|
}
|