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
|
:cljs
|
||||||
(defn obj-extends? [prot-sym obj]
|
(defn obj-extends? [prot-sym obj]
|
||||||
;; this requires that prot-sym be fully qualified
|
(if (nil? obj)
|
||||||
(let [props (->> obj type .-prototype (.getOwnPropertyNames js/Object) seq)
|
(= prot-sym `p/StructurePath)
|
||||||
ns (namespace prot-sym)
|
;; this requires that prot-sym be fully qualified
|
||||||
n (name prot-sym)
|
(let [props (->> obj type .-prototype (.getOwnPropertyNames js/Object) seq)
|
||||||
lookup (str (s/replace ns "." "$") "$" n "$")]
|
ns (namespace prot-sym)
|
||||||
(seq-contains? props lookup)
|
n (name prot-sym)
|
||||||
))
|
lookup (str (s/replace ns "." "$") "$" n "$")]
|
||||||
|
(seq-contains? props lookup)
|
||||||
|
)))
|
||||||
)
|
)
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue