@e-group/utils
Version:
eGroup team utils that share across projects.
21 lines (16 loc) • 382 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
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;
};
var _default = calcPercent;
exports.default = _default;