"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toNumber = exports.parseValue = exports.bindToMinMax = void 0;

var bindToMinMax = function bindToMinMax(value, min, max) {
  return Math.min(Math.max(value, min), max);
};

exports.bindToMinMax = bindToMinMax;

var parseValue = function parseValue(value, min, max) {
  return bindToMinMax(toNumber(value), min, max);
};

exports.parseValue = parseValue;

var toNumber = function toNumber(rawNumber) {
  var number = parseFloat(rawNumber);

  if (isNaN(number) || !isFinite(number)) {
    number = 0;
  }

  return number;
};

exports.toNumber = toNumber;