Skip to content

Commit 60617a9

Browse files
fix regexp when typeof scrollThreshold is string
before fix, '1d2px' is matched
1 parent 8e0069d commit 60617a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/utils/threshold.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ export function parseThreshold(scrollThreshold) {
1717
}
1818

1919
if (typeof scrollThreshold === "string") {
20-
if (scrollThreshold.match(/^(\d*(.\d+)?)px$/)) {
20+
if (scrollThreshold.match(/^(\d*(\.\d+)?)px$/)) {
2121
return {
2222
unit: ThresholdUnits.Pixel,
2323
value: parseFloat(scrollThreshold),
2424
};
2525
}
2626

27-
if (scrollThreshold.match(/^(\d*(.\d+)?)%$/)) {
27+
if (scrollThreshold.match(/^(\d*(\.\d+)?)%$/)) {
2828
return {
2929
unit: ThresholdUnits.Percent,
3030
value: parseFloat(scrollThreshold),

0 commit comments

Comments
 (0)