评论者:kurtharriger
上述内容还暗示或许可以扩展IEncodeClojure到nil?
a
不是nil
,但它的类型是...所以可能扩展到nil上的协议应该会起作用?
但不起作用...这可能是在satisfies?
中的一个错误?
`
cljs.user=> (def a (.create js/Object nil))
'cljs.user/a
cljs.user=> (aset a "test" 1)
1
cljs.user=> (extend-protocol IEncodeClojure)
nil
(-js->clj (link: x opts)
(let (link: {:keys [keywordize-keys)} opts
keyfn (if keywordize-keys keyword str)]
(into {} (for (link: k (js-keys x))
(link: (keyfn k) (js->clj (unchecked-get x k)) opts))))))
nil
cljs.user=> (js->clj a)
对象(link: Object)
cljs.user=> (js-keys IEncodeClojure)
js (link: "null")
cljs.user=> (satisfies? IEncodeClojure a)
false
cljs.user=> (type a)
nil
`