1
0
mirror of synced 2025-12-19 18:10:59 -05:00

find orphaned features: use Number() instead of parseFloat() (#50024)

Co-authored-by: Peter Bengtsson <peterbe@github.com>
This commit is contained in:
Robert Sese
2024-04-08 11:35:04 -05:00
committed by GitHub
parent b5a5e2ce4d
commit 538dcc249c

View File

@@ -27,6 +27,7 @@
* *
*/ */
import { strictEqual } from 'node:assert'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
@@ -296,5 +297,9 @@ function escapeRegex(string: string) {
} }
function isFloat(x: any) { function isFloat(x: any) {
return !!(parseFloat(x) + 1) return !!(Number(x) + 1)
} }
strictEqual(isFloat('1.2'), true)
strictEqual(isFloat('10'), true)
strictEqual(isFloat('notatall'), false)
strictEqual(isFloat('2fa'), false)