tickle/modules/utils/percentFromProgress.mjs

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