Skip to content

Commit

Permalink
Split map handling
Browse files Browse the repository at this point in the history
  • Loading branch information
YurySolovyov committed Jul 2, 2017
1 parent 694657f commit f766818
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/class_names/core.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
(ns class-names.core)

(defn class-names-map [map]
(reduce (fn [map-arr [key value]]
(if (true? value)
(conj map-arr key)
map-arr)) [] map))

(defn class-names [& args]
(clojure.string/join " "
(mapv name
Expand All @@ -9,9 +15,5 @@
(symbol? arg)
(keyword? arg)) (conj arr arg)
(vector? arg) (vec (concat arr arg))
(map? arg) (vec (concat arr
(reduce-kv (fn [map-arr key value]
(if (true? value)
(conj map-arr key)
map-arr)) [] arg)))
(map? arg) (vec (concat arr (class-names-map arg)))
:else arr)) [] args))))

0 comments on commit f766818

Please sign in to comment.