Skip to content

Commit

Permalink
revert (4)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdamAme-x committed Nov 9, 2024
1 parent f4c0b2f commit 90af290
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/router/trie-router/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,14 @@ export class Node<T> {
nextNode.params = node.params
if (isLast) {
// '/hello/*' => match '/hello'
const astNode = nextNode.children['*']
if (astNode) {
if (nextNode.children['*']) {
handlerSets.push(
...this.#getHandlerSets(astNode, method, node.params, Object.create(null))
...this.#getHandlerSets(
nextNode.children['*'],
method,
node.params,
Object.create(null)
)
)
}
handlerSets.push(
Expand All @@ -150,7 +154,7 @@ export class Node<T> {
// '/hello/*/foo' => match /hello/bar/foo
if (pattern === '*') {
const astNode = node.children['*']
if (astNode) {
if (node.children['*']) {
handlerSets.push(
...this.#getHandlerSets(astNode, method, node.params, Object.create(null))
)
Expand Down Expand Up @@ -179,9 +183,10 @@ export class Node<T> {
params[name] = part
if (isLast) {
handlerSets.push(...this.#getHandlerSets(child, method, params, node.params))
const astNode = child.children['*']
if (astNode) {
handlerSets.push(...this.#getHandlerSets(astNode, method, params, node.params))
if (child.children['*']) {
handlerSets.push(
...this.#getHandlerSets(child.children['*'], method, params, node.params)
)
}
} else {
child.params = params
Expand Down

0 comments on commit 90af290

Please sign in to comment.