tickle/modules/utils/percentFromProgress.mjs

10 lines
286 B
JavaScript
Raw Normal View History

2023-06-06 22:45:16 +00:00
//@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