clean up some syntax with ->

This commit is contained in:
Bart Akeley 2017-10-21 16:11:30 -05:00
parent cc61d02804
commit 54b79f4f5d

View file

@ -56,13 +56,17 @@
(if (instance? java.util.UUID value) (.toString value) value))
(defn get-coords [item]
(get (json/read-str (get item :location)) "coordinates"))
(-> item (get :location) json/read-str (get "coordinates")))
(defn build-lat-lng [[lng lat]]
(hash-map :longitude lng :latitude lat))
(defn parse-location [item]
(dissoc (merge item (build-lat-lng (get-coords item))) :location))
(defn build-latlng [item]
(let [[lng lat] (get-coords item)]
(hash-map :longitude lng :latitude lat)))
(defn parse-location [item]
(-> item build-latlng (merge item) (dissoc :location)))
(defn food-items-to-json [response]
(map parse-location response))