js-on-sx: js-num-to-int coerces strings via js-to-number

This commit is contained in:
2026-04-23 21:59:08 +00:00
parent 60bb7c4687
commit b502b8f58e
2 changed files with 15 additions and 1 deletions

View File

@@ -1392,7 +1392,11 @@
(define
js-num-to-int
(fn (n) (if (>= n 0) (floor n) (- 0 (floor (- 0 n))))))
(fn
(v)
(let
((n (if (number? v) v (js-to-number v))))
(if (>= n 0) (floor n) (- 0 (floor (- 0 n)))))))
(define dict-has? (fn (d k) (contains? (keys d) k)))