Browse code

Add indexing to property list and refactor using 'for' loop

Joseph Weston authored on 05/12/2021 20:17:04
Showing 1 changed files
... ...
@@ -58,13 +58,8 @@
58 58
 (defn- property-list [& props]
59 59
     (into
60 60
      [:ul {:class (styles/property-list)}]
61
-     (->> props
62
-          (partition 2)
63
-          (filter second)
64
-          (map #(vector
65
-                 :li
66
-                 [:span (first %)]
67
-                 [:span (second %)])))))
61
+     (for [[index [prop v]] (->> props (partition 2) (filter second) enumerated)]
62
+       ^{:key index} [:li [:span prop] [:span v]])))
68 63
 
69 64
 
70 65
 (defn- property-table [items & props]