js-on-sx: Object.getOwnPropertyNames throws on null, adds length for str/arr
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s

This commit is contained in:
2026-05-09 23:12:43 +00:00
parent b4f7f814be
commit f15a8d8fef
2 changed files with 16 additions and 1 deletions

View File

@@ -4227,8 +4227,21 @@
(fn
(o)
(cond
((or (= o nil) (js-undefined? o))
(raise (js-new-call TypeError (js-args "Object.getOwnPropertyNames called on null or undefined"))))
((list? o)
(let ((r (list))) (begin (js-list-keys-loop o 0 r) r)))
(let
((r (list)))
(begin
(js-list-keys-loop o 0 r)
(append! r "length")
r)))
((= (type-of o) "string")
(let ((result (list)) (n (len o)))
(begin
(js-string-keys-loop result 0 n)
(append! result "length")
result)))
((dict? o) (js-own-property-names-ordered o))
(else (list)))))