mirror of
https://github.com/metosin/reitit.git
synced 2025-12-23 02:41:10 +00:00
mega-insert for trie!
This commit is contained in:
parent
8628f0cec6
commit
4c0d2fb285
1 changed files with 10 additions and 2 deletions
|
|
@ -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-> []
|
||||
|
|
|
|||
Loading…
Reference in a new issue