16 lines
408 B
TypeScript
16 lines
408 B
TypeScript
import { type ClassValue, clsx } from 'clsx'
|
|
import { twMerge } from 'tailwind-merge'
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export function calculateScore(correct: number, total: number): number {
|
|
if (total === 0) return 0
|
|
return Math.round((correct / total) * 20 * 100) / 100
|
|
}
|
|
|
|
export function formatScore(score: number): string {
|
|
return score.toFixed(2)
|
|
}
|