š
Hi there. Iām looking for a way to author a specter path that can select a string or vector of strings.
My data looks like this: (emails for the postal
library).
(def m1 {:to ["<mailto:to2@example.com|to2@example.com>" "<mailto:to2@example.com|to2@example.com>"]
:cc "<mailto:cc@example.com|cc@example.com>"
:bcc nil})
(def m2 {:to []
:cc []
:bcc ["<mailto:info@example.com|info@example.com>"]})
I want to collect all email addresses in the message, using specter/select
I ended up with:
(defn- has-recipients?
"True if this email has any recipients"
[message]
(s/selected-any? [(s/multi-path :to :cc :bcc)
(s/if-path sequential? s/ALL some?)]
message))
@marc-omorain that's perfect
Thanks!