specter

Latest version: 1.1.3
huthayfa 2018-05-24T21:16:48.000406Z

is there a function to collect the path to a given key

huthayfa 2018-05-24T21:22:08.000080Z

if i have map like this {"properties": { "assets": {"target-key"}}}, I want to collect the path to target-key which is [properties assets target-key]

huthayfa 2018-05-24T21:22:24.000634Z

is there a function in specter that does this

nathanmarz 2018-05-24T21:58:42.000222Z

@huthayfa.ainqawi use the collect navigators

nathanmarz 2018-05-24T21:59:15.000449Z

someone just asked this recently

nathanmarz 2018-05-24T21:59:24.000417Z

here's a code example:

(def MAP-VALS+ (path ALL (collect-one FIRST) LAST))
(transform [MAP-VALS+ MAP-VALS+ MAP-VALS]
  (fn [k1 k2 v]
    [k1 k2 v]
    )
  {"2018-05-22" {:A {123 "foo"}}})

huthayfa 2018-05-24T22:32:34.000350Z

@nathanmarz how do I select the target key