formatPercentage
Formats a number as a localized percentage. The input is treated as a ratio, so 0.875 becomes an 87.5%-style label depending on locale.
Importing
ts
import { formatPercentage } from '@almighty-shogun/utils'Usage
ts
import { formatPercentage } from '@almighty-shogun/utils'
const completion = formatPercentage(0.875, 'en');Parameters
| Name | Type | Description |
|---|---|---|
value | number | Value to format. |
locale | string | Optional locale override. |
Returns
A localized percentage string. The input is treated as a ratio, so 0.5 represents fifty percent.
Type signature
ts
declare function formatPercentage(
value: number,
locale?: string
): string;