Fork me on GitHub
#specter
<
2018-08-03
>
miikka12:08:47

So I'm pretty new to Specter, but I'm trying to navigate a vector like [{:id 1, :value 2} {:id 2, :value 1}] by :id. (I know that this would be ideally a map, but it's not for now.) [MAP-VALS #(= x (:id %))] seems to work, but how do I define a navigator so that it's reusable?

miikka12:08:12

Is this the right way to do it?

(defn by-id [id] (specter/path [specter/MAP-VALS #(= (:id %) id)]))

miikka13:08:01

uh, that should be ALL, not MAP-VALS

nathanmarz15:08:22

@miikka yes, that's exactly right

vigilancetech22:08:14

anyone have an idea why I'd be getting this error in 1.1.1 but not 1.1.0?

WARNING: Use of undeclared Var cljs.core/MapEntry at line 84 /home/kevin/.boot/cache/tmp/home/kevin/0work/jbog/guardian-dashboard/cul/v9pufs/index.html.out/com/rpl/specter/navs.cljc
I just erased .boot/cache and recompiled and the same error is there

nathanmarz23:08:11

@vigilancetech that's related to a change in ClojureScript 1.10

nathanmarz23:08:15

you should upgrade your cljs