Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
26
node_modules/hono/dist/router/trie-router/router.js
generated
vendored
Normal file
26
node_modules/hono/dist/router/trie-router/router.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// src/router/trie-router/router.ts
|
||||
import { checkOptionalParameter } from "../../utils/url.js";
|
||||
import { Node } from "./node.js";
|
||||
var TrieRouter = class {
|
||||
name = "TrieRouter";
|
||||
#node;
|
||||
constructor() {
|
||||
this.#node = new Node();
|
||||
}
|
||||
add(method, path, handler) {
|
||||
const results = checkOptionalParameter(path);
|
||||
if (results) {
|
||||
for (let i = 0, len = results.length; i < len; i++) {
|
||||
this.#node.insert(method, results[i], handler);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.#node.insert(method, path, handler);
|
||||
}
|
||||
match(method, path) {
|
||||
return this.#node.search(method, path);
|
||||
}
|
||||
};
|
||||
export {
|
||||
TrieRouter
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue