Skip to content

Commit f74971d

Browse files
authored
fixed converters/valueToPosition (ptomasroos#190)
The fact that this function is still returning a position when value is undefined was causing me an issue in single slider mode as under some conditions (after changing min and max values) it was setting positionTwo equal to max. I think it's better it returns undefined when value is undefined
1 parent 9a6e257 commit f74971d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

converters.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const closest = (array, n) => {
3939
};
4040

4141
export function valueToPosition(value, valuesArray, sliderLength) {
42+
if (value === undefined)
43+
return undefined;
4244
const index = closest(valuesArray, value);
4345

4446
const arrLength = valuesArray.length - 1;

0 commit comments

Comments
 (0)