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
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
This commit is contained in:
@@ -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)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user