mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
9 lines
233 B
TypeScript
9 lines
233 B
TypeScript
/**
|
|
* Format a fraction (0...1) into a percent, rounded to the nearest decimal place.
|
|
*
|
|
* toRoundedPercent(0.42555) === '42%'
|
|
*/
|
|
export default function toRoundedPercent(value: number) {
|
|
return `${Math.round(value * 100)}%`;
|
|
}
|