Files

9 lines
229 B
JavaScript
Raw Permalink Normal View History

2025-11-14 11:39:33 +08:00
export function getRoundingMethod(method) {
return (number) => {
const round = method ? Math[method] : Math.trunc;
const result = round(number);
// Prevent negative zero
return result === 0 ? 0 : result;
};
}