 (defn inventory-pokemon
   "Return all pokemon which are currently stored."
   []
-  (get-in @app-state [:inventory :pokemon]))+  (get-in @app-state [:pokemon]))
+
+
+;;;; Conversions
+(defn json->clj
+  "Use cognitec's transit reader for json to convert it to proper Clojure datastructures."
+  [response]
+  (let [r (transit/reader :json)]
+    (keywordize-keys (transit/read r response))))
(ns crunsher.lib
  (:require [om.next :as om]))

(defonce app-state
         (atom
           {:inventory {:pokemon [{:id   4
                                   :name "Glumanda"}
                                  {:id   25
                                   :name "Pikachu"}
                                  ]}}))


;;;; React compatibility

(defmulti mutate om/dispatch)

#_(defmethod mutate 'color/temp
    [{:keys [state]} _ {:keys [color]}]
    {:action (fn [] (swap! state update-in [:user :selected-color] (fn [] color)))})

#_(defmethod mutate 'color/set
    [{:keys [state]} _ {:keys [name field]}]
    (let [color (get-selected-color)]
      {:action (fn [] (swap! state update-in [:scarf field] (fn [] color)))}))

(defonce reconciler
         (om/reconciler
