Skip to content

Commit

Permalink
Add IIndexed protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser committed Sep 7, 2014
1 parent 52984e0 commit 89260e4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mori.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@
IHash
(-hash [this] (.call (aget methods "hash") this))))

(defn extend-to-iindexed [obj methods]
(specify! obj
IIndexed
(-nth [this k] (.call (aget methods "nth") this))
(-nth [this k not-found] (.call (aget methods "nth") this))))

(defn extend-to-ikvreduce [obj methods]
(specify! obj
IKVReduce
Expand Down Expand Up @@ -368,6 +374,7 @@
"IEncodeJS" (extend-to-iencodejs obj methods)
"IEquiv" (extend-to-iequiv obj methods)
"IHash" (extend-to-ihash obj methods)
"IIndexed" (extend-to-iindexed obj methods)
"IKVReduce" (extend-to-ikvreduce obj methods)
"ILookup" (extend-to-ilookup obj methods)
"IMap" (extend-to-imap obj methods)
Expand Down

0 comments on commit 89260e4

Please sign in to comment.