diff --git a/modules/reitit-core/src/reitit/trie.cljc b/modules/reitit-core/src/reitit/trie.cljc index aa4fb2fc..a1f3aa9c 100644 --- a/modules/reitit-core/src/reitit/trie.cljc +++ b/modules/reitit-core/src/reitit/trie.cljc @@ -89,8 +89,16 @@ (update :children dissoc "")) node'))) -(defn insert [node path data] - (-insert (or node (-node {})) (-split path) data)) +(defn insert + ([routes] + (insert nil routes)) + ([node routes] + (reduce + (fn [acc [p d]] + (insert acc p d)) + node routes)) + ([node path data] + (-insert (or node (-node {})) (-split path) data))) (defn ^Trie$Matcher compile [{:keys [data children wilds catch-all]}] (let [matchers (cond-> []