Skip to content

Commit 538dcc2

Browse files
rsesePeter Bengtsson
andauthored
find orphaned features: use Number() instead of parseFloat() (#50024)
Co-authored-by: Peter Bengtsson <[email protected]>
1 parent b5a5e2c commit 538dcc2

File tree

1 file changed

+6
-1
lines changed
  • src/data-directory/scripts/find-orphaned-features

1 file changed

+6
-1
lines changed

src/data-directory/scripts/find-orphaned-features/find.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*
2828
*/
2929

30+
import { strictEqual } from 'node:assert'
3031
import fs from 'fs'
3132
import path from 'path'
3233

@@ -296,5 +297,9 @@ function escapeRegex(string: string) {
296297
}
297298

298299
function isFloat(x: any) {
299-
return !!(parseFloat(x) + 1)
300+
return !!(Number(x) + 1)
300301
}
302+
strictEqual(isFloat('1.2'), true)
303+
strictEqual(isFloat('10'), true)
304+
strictEqual(isFloat('notatall'), false)
305+
strictEqual(isFloat('2fa'), false)

0 commit comments

Comments
 (0)