mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
9 lines
220 B
TypeScript
9 lines
220 B
TypeScript
/**
|
|
* Format a fraction (0...1) into a percent, fixed & rounded to 3 decimal places.
|
|
*
|
|
* toPercent(0.42) === '42.000%'
|
|
*/
|
|
export default function toPercent(value: number) {
|
|
return `${(value * 100).toFixed(3)}%`;
|
|
}
|