numberPercentage
Calculates the percentage of `calculateFrom` relative to `total`. The result is rounded to two decimal places.> numberPercentage(total: number, calculateFrom: number): number
- total: The total number (denominator) for calculating the percentage.
- calculateFrom: The number (numerator) from which the percentage is calculated.
- Returns: The percentage value as a number.
Example
import { numberPercentage } from "@explita/daily-toolset";
numberPercentage(200, 50); // 25
numberPercentage(500, 125); // 25
numberPercentage(0, 50); // Returns 0 (if total is 0)