Files
tickle/modules/utils/percentFromProgress.mjs
2023-06-07 00:45:16 +02:00

10 lines
286 B
JavaScript

//@ts-check
/**
* Returns a formatted percent from a given fraction.
* @param {number} fraction any fractional number, e.g, 5/10
*/
export const percentFromProgress = (fraction) =>
/** @type {`${string}%`} */ (Math.round(fraction * 100) + "%");
export default percentFromProgress