"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.roundToNearest = void 0;
var _constants = require("./constants");
/**
 * Returns the number rounded to the nearest interval.
 * @param {number} value    The number to round
 * @param {number} interval The numeric interval to round to, default to 0.5
 * @returns {number} the rounded number
 */
var roundToNearest = exports.roundToNearest = function roundToNearest(value) {
  var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.DEFAULT_ROUNDING_INTERVAL;
  return Math.round(value / interval) * interval;
};