fixed cljs obj-extends? to have special case for nil because it cannot be reflected on like normal objects
This commit is contained in:
parent
72b16d1ab1
commit
38fed4a7d0
1 changed files with 9 additions and 7 deletions
|
|
@ -102,13 +102,15 @@
|
|||
|
||||
:cljs
|
||||
(defn obj-extends? [prot-sym obj]
|
||||
;; this requires that prot-sym be fully qualified
|
||||
(let [props (->> obj type .-prototype (.getOwnPropertyNames js/Object) seq)
|
||||
ns (namespace prot-sym)
|
||||
n (name prot-sym)
|
||||
lookup (str (s/replace ns "." "$") "$" n "$")]
|
||||
(seq-contains? props lookup)
|
||||
))
|
||||
(if (nil? obj)
|
||||
(= prot-sym `p/StructurePath)
|
||||
;; this requires that prot-sym be fully qualified
|
||||
(let [props (->> obj type .-prototype (.getOwnPropertyNames js/Object) seq)
|
||||
ns (namespace prot-sym)
|
||||
n (name prot-sym)
|
||||
lookup (str (s/replace ns "." "$") "$" n "$")]
|
||||
(seq-contains? props lookup)
|
||||
)))
|
||||
)
|
||||
|
||||
#?(:clj
|
||||
|
|
|
|||
Loading…
Reference in a new issue