Skip to content

Commit 1f8c201

Browse files
committed
Little improvements
1 parent d5538d1 commit 1f8c201

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

packages/react-native-reanimated/src/interpolation.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,27 @@ export function narrowInterpolationRange<TOutput>(
171171
leftEdgeOutput: outputRange[length - 2],
172172
rightEdgeOutput: outputRange[length - 1],
173173
};
174-
} else {
175-
let left = 0;
176-
let right = length - 1;
177-
178-
while (left < right) {
179-
const mid = Math.floor((left + right) / 2);
180-
if (x <= inputRange[mid]) {
181-
right = mid;
182-
} else {
183-
left = mid + 1;
184-
}
185-
}
174+
}
186175

187-
const segmentIndex = Math.max(1, left);
188-
return {
189-
leftEdgeInput: inputRange[segmentIndex - 1],
190-
rightEdgeInput: inputRange[segmentIndex],
191-
leftEdgeOutput: outputRange[segmentIndex - 1],
192-
rightEdgeOutput: outputRange[segmentIndex],
193-
};
176+
let left = 1;
177+
let right = length - 1;
178+
179+
while (left < right) {
180+
const mid = Math.floor((left + right) / 2);
181+
if (x <= inputRange[mid]) {
182+
right = mid;
183+
} else {
184+
left = mid + 1;
185+
}
194186
}
187+
188+
const segmentIndex = left;
189+
return {
190+
leftEdgeInput: inputRange[segmentIndex - 1],
191+
rightEdgeInput: inputRange[segmentIndex],
192+
leftEdgeOutput: outputRange[segmentIndex - 1],
193+
rightEdgeOutput: outputRange[segmentIndex],
194+
};
195195
}
196196

197197
/**

0 commit comments

Comments
 (0)