I have a codebase that heavily uses get and get-in for nested forms. I want to be able to use my own javascript objects without rewriting (large) code.
js> cljs.user.o = {foo: 42} // in js console cljs.user> (get o "foo") ; => 42 ; in cljs console
Since I only request forms, but donβt change them, I thought this would be enough to implement get (which get-in relies on). Here is my attempt
(extend-protocol ILookup js/Object (-lookup [mk] (aget mk)) (-lookup [mk not-found (or (aget mk) not-found)))
It seems to work, but it strangely breaks a lot of things.
source share