diff --git a/src/class_names/core.cljs b/src/class_names/core.cljs index 5a032f1..d8631a1 100644 --- a/src/class_names/core.cljs +++ b/src/class_names/core.cljs @@ -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 @@ -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))))