matcher-combinators
matcher-combinators copied to clipboard
`seq-of` matcher
Add a matcher that matches a non-empty sequence of elements that match a supplied matcher, e.g.
(match? (seq-of {:name string? :id uuid?})
[{:name "Michael"
:id #uuid "c70e35eb-9eb6-4e3d-b5da-1f7f80932db9"}])
This impl works, but the resulting failure message leaves something to be desired:
(defn seq-of [matcher] (fn [coll] (and (seq coll) (every? (partial matcher-combinators.standalone/match? matcher) coll))))