UNPKG

@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.

20 lines (17 loc) 586 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; 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; }; var _default = validateIncrement; exports.default = _default;