timepiece/node_modules/date-fns/_lib/getRoundingMethod.js

12 lines
284 B
JavaScript
Raw Normal View History

2024-05-14 14:54:12 +00:00
"use strict";
exports.getRoundingMethod = getRoundingMethod;
function getRoundingMethod(method) {
return (number) => {
const round = method ? Math[method] : Math.trunc;
const result = round(number);
// Prevent negative zero
return result === 0 ? 0 : result;
};
}