@daysnap/utils
Version:
15 lines (11 loc) • 422 B
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});// src/roundUpToNearestInteger.ts
function roundUpToNearestInteger(num) {
if (!num) {
return 1;
}
const symbol = num > 0 ? 1 : -1;
num = Math.abs(num);
const magnitude = Math.pow(10, Math.floor(Math.log10(num)));
return Math.ceil(num / magnitude) * magnitude * symbol;
}
exports.roundUpToNearestInteger = roundUpToNearestInteger;