Skip to content

Commit c790ca8

Browse files
authored
fix: code scanning alerts (#970)
1 parent e3d5d45 commit c790ca8

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/hooks/useOffset.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ export default function useOffset(
3838
pushable: false | number,
3939
): [FormatValue, OffsetValues] {
4040
const formatRangeValue: FormatRangeValue = React.useCallback(
41-
(val) => {
42-
let formatNextValue = isFinite(val) ? val : min;
43-
formatNextValue = Math.min(max, val);
44-
formatNextValue = Math.max(min, formatNextValue);
45-
46-
return formatNextValue;
47-
},
41+
(val) => Math.max(min, Math.min(max, val)),
4842
[min, max],
4943
);
5044

tests/Range.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ describe('Range', () => {
348348
setValue(values);
349349
onChange(values);
350350
}}
351-
value={[20, 40]}
351+
value={value}
352352
allowCross={false}
353353
pushable
354354
/>

0 commit comments

Comments
 (0)