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
value: number
Value to format.
locale?: string
Locale override.
Returns
A localized percentage string. The input is treated as a ratio, so0.5 represents fifty percent.Type signature
ts
declare function formatPercentage(
value: number,
locale?: string
): string;