More refactoring.

This commit is contained in:
Simon Brooke 2022-12-25 15:15:33 +00:00
parent a4b0e43a76
commit 09ebdafff5
2 changed files with 55 additions and 53 deletions

View file

@ -144,6 +144,12 @@
`(if (and (coll? ~x) (empty? ~x)) nil
~x))
(defn concat-non-empty
"Quick function to replace the pattern (nil-if-empty (remove nil? (concat ...)))
which I'm using a lot!"
[& lists]
(nil-if-empty (remove nil? (apply concat lists))))
(defn has-type-or-fault
"If object `x` has a `:type` value which is `acceptable`, return `nil`;
else return a fault object with this `severity` and `token`.