mirror of
https://github.com/prowler-cloud/prowler.git
synced 2025-12-19 05:17:47 +00:00
20 lines
607 B
TypeScript
20 lines
607 B
TypeScript
import { type ClassValue, clsx } from "clsx";
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
export const SPECIAL_CHARACTERS = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
|
|
|
/**
|
|
* Calculates a percentage and rounds it to the nearest integer
|
|
* @param value - The numerator value
|
|
* @param total - The denominator value
|
|
* @returns The rounded percentage (0-100), or 0 if total is 0
|
|
*/
|
|
export function calculatePercentage(value: number, total: number): number {
|
|
if (total === 0) return 0;
|
|
return Math.round((value / total) * 100);
|
|
}
|