File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 18
18
sum inc dec even? odd? subseq
19
19
apply])
20
20
(:use-macros [mori.macros :only [make-inspectable]])
21
- (:require [clojure.set :as set]
21
+ (:require [goog.object]
22
+ [clojure.set :as set]
22
23
[clojure.data :as data]
23
24
[clojure.core.reducers :as reducers]
24
25
[cljs.reader :as reader]))
348
349
ISeqable
349
350
(-seq [this] (.call (aget methods " seq" ) this))))
350
351
351
- (defn ^:export extend [protocol-name obj methods]
352
+ (defn extend! [protocol-name obj methods]
352
353
(case protocol-name
353
354
" IAssociative" (extend-to-iassociative obj methods)
354
355
" ICloneable" (extend-to-icloneable obj methods)
365
366
" ISeqable" (extend-to-iseqable obj methods)
366
367
(throw (js/Error. (str " Cannot extend to " protocol-name)))))
367
368
369
+ (defn ^:export extend [obj protocols]
370
+ (goog.object/forEach protocols
371
+ (fn [val key o]
372
+ (extend! key obj val)))
373
+ obj )
374
+
368
375
; ; =============================================================================
369
376
; ; Closure hacks so we get exported ES6 Map/Set interface on collections
370
377
; ; Following functions are NOT a part of the API
You can’t perform that action at this time.
0 commit comments