@evojs/math
Version:
Nodejs math extension
13 lines (12 loc) • 326 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.round = void 0;
function round(x, digits) {
if (digits === void 0) { digits = 0; }
if (digits > 0) {
digits = Math.pow(10, Math.round(digits));
return Math.round(x * digits) / digits;
}
return Math.round(x);
}
exports.round = round;