INNER CODE UNIT · TypeScript
diff
terrysahaidak/react-native-gallery-toolkit · packages/common/src/common.ts:60
const diff = Math.abs(index - activeIndex);
if (diff > diffValue) {
return false;
}
return true;
}
export function clamp(
value: number,
lowerBound: number,
upperBound: number,
) {
'worklet';
return Math.min(Math.max(lowerBound, value), upperBound);
}