UNPKG

@e-group/utils

Version:

eGroup team utils that share across projects.

13 lines (10 loc) 247 B
const calcPercent = (a, b) => { if (typeof a === 'number' && typeof b === 'number') { if (b === 0) { return '0%'; } return "".concat(Math.round(a / b * 100 * 100) / 100, "%"); } return NaN; }; export default calcPercent;