19 lines
498 B
JavaScript
Raw Normal View History

2024-01-29 09:26:07 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRoundingMethod = getRoundingMethod;
var roundingMap = {
ceil: Math.ceil,
round: Math.round,
floor: Math.floor,
trunc: function trunc(value) {
return value < 0 ? Math.ceil(value) : Math.floor(value);
} // Math.trunc is not supported by IE
};
var defaultRoundingMethod = 'trunc';
function getRoundingMethod(method) {
return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
}