@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 validateIncrement = function validateIncrement(_ref) {
var value = _ref.value,
_ref$maxValue = _ref.maxValue,
maxValue = _ref$maxValue === void 0 ? Number.POSITIVE_INFINITY : _ref$maxValue,
_ref$step = _ref.step,
step = _ref$step === void 0 ? 1 : _ref$step;
var newValue = value + step;
var calculatedValue = newValue >= +maxValue ? maxValue : newValue;
return calculatedValue;
};
export default validateIncrement;