@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
12 lines (11 loc) • 451 B
JavaScript
var validateDecrement = function validateDecrement(_ref) {
var value = _ref.value,
_ref$minValue = _ref.minValue,
minValue = _ref$minValue === void 0 ? Number.NEGATIVE_INFINITY : _ref$minValue,
_ref$step = _ref.step,
step = _ref$step === void 0 ? 1 : _ref$step;
var newValue = value - step;
var calculatedValue = newValue <= +minValue ? minValue : newValue;
return calculatedValue;
};
export default validateDecrement;