function | removed v0.0-2655 | added v0.0-2629 | Edit |
(merge-require requires [lib :as spec])
(defn merge-require [requires [lib :as spec]]
(let [[before [match & after]]
(split-with
(fn [[lib' & _]]
(not= lib lib'))
requires)]
(if (nil? match)
;; no match, append to end
(concat requires [spec])
(if (= match spec)
;; dupe
requires
;; merge
(concat before [(merge-spec match spec)] after)))))