SolyQuiz/lib/utils.ts
corenthin-lebreton 28aa3b0e10 initial project
2026-02-26 20:10:14 +01:00

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)
}