Reputation: 58786
I have a series of ClojureScript objects, but only some of them implement a certain protocol. how can I detect if the protocol is extended on a particular object?
Upvotes: 1
Views: 236
Reputation: 5231
You can use satisfies?
to check if the object extends the protocol.
(defprotocol p
(go [_] nil))
(deftype t []
p
(go [this] true))
(satisfies? p (t.)) ;=> true
Upvotes: 2