import isNil from '../node_modules/lodash-es/isNil.js';
import 'core-js/modules/es.array.concat.js';
import 'core-js/modules/es.array.filter.js';
import 'core-js/modules/es.object.to-string.js';

var useMatchingThreshold = function useMatchingThreshold(_ref) {
  var thresholds = _ref.thresholds,
    value = _ref.value;
  if (!(thresholds !== null && thresholds !== void 0 && thresholds.length)) {
    return null;
  }
  return thresholds.filter(function (t) {
    if (typeof t.comparison === 'function') {
      return t.comparison(value);
    }
    switch (t.comparison) {
      case '<':
        return !isNil(value) && value < t.value;
      case '>':
        return value > t.value;
      case '=':
        return value === t.value;
      case '<=':
        return !isNil(value) && value <= t.value;
      case '>=':
        return value >= t.value;
      default:
        return false;
    }
  }).concat([null])[0];
};
var useMatchingThreshold$1 = useMatchingThreshold;

export { useMatchingThreshold$1 as default };
