UNPKG

react-native-timer-picker

Version:

A simple, flexible, performant duration picker for React Native apps 🔥 Great for timers, alarms and duration inputs ⏰🕰️⏳ Includes iOS-style haptic and audio feedback 🍏

26 lines (24 loc) 675 B
export const getAdjustedLimit = (limit, numberOfItems, interval) => { const maxValue = (numberOfItems - 1) * interval; if (!limit || !limit.max && !limit.min) { return { max: maxValue, min: 0 }; } // guard against limits that are out of bounds const adjustedMaxLimit = limit.max ? Math.min(limit.max, maxValue) : maxValue; const adjustedMinLimit = limit.min ? Math.max(limit.min, 0) : 0; // guard against invalid limits if (adjustedMaxLimit < adjustedMinLimit) { return { max: maxValue, min: 0 }; } return { max: adjustedMaxLimit, min: adjustedMinLimit }; }; //# sourceMappingURL=getAdjustedLimit.js.map