specter

Latest version: 1.1.3
rafael 2017-12-21T14:59:08.000619Z

The ensure-matching solution above worked for us, thanks.

rafael 2017-12-21T14:59:51.000219Z

We also found the need for another defdynamicnav, I'm posting it here in case anyone finds it helpful:

(specter/defdynamicnav look-ahead [path]
  (specter/if-path path specter/STAY (specter/terminal-val specter/NONE)))

rafael 2017-12-21T15:00:40.000280Z

It is used like this:

(transform [ALL (schema-check/look-ahead (must :a))] str [{:a 1 :b 1} {:x 2 :b 2}])
evaluates to => ["{:a 1, :b 1}"]

rafael 2017-12-21T15:01:36.000520Z

Another example:

(transform [ALL (schema-check/look-ahead (must :a)) :b] str [{:a 1 :b 1} {:x 2 :b 2}])
=> [{:a 1, :b "1"}]

nathanmarz 2017-12-21T15:04:41.000546Z

@rafael cool

nathanmarz 2017-12-21T15:05:09.000340Z

I opened an issue to add functionality like this into Specter https://github.com/nathanmarz/specter/issues/240

🆒 1