js-on-sx: parseFloat/parseInt return NaN for digitless prefix
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
This commit is contained in:
@@ -4523,8 +4523,19 @@
|
||||
((end (js-float-prefix-end s 0 false false false)))
|
||||
(cond
|
||||
((= end 0) (js-nan-value))
|
||||
((not (js-str-has-digit? s 0 end)) (js-nan-value))
|
||||
(else (js-parse-num-safe (js-string-slice s 0 end)))))))))
|
||||
|
||||
(define
|
||||
js-str-has-digit?
|
||||
(fn
|
||||
(s i n)
|
||||
(cond
|
||||
((>= i n) false)
|
||||
((let ((c (char-at s i))) (and (>= (char-code c) 48) (<= (char-code c) 57)))
|
||||
true)
|
||||
(else (js-str-has-digit? s (+ i 1) n)))))
|
||||
|
||||
(define
|
||||
js-float-has-infinity-prefix?
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user