(node: URLTrieNode, index: number)
| 525 | } |
| 526 | |
| 527 | const matchHost = (node: URLTrieNode, index: number) => { |
| 528 | const finalHostNode = node.hostNodes.get(''); |
| 529 | const noMoreHostParts = index === u.hostParts.length; |
| 530 | const value = noMoreHostParts ? '' : u.hostParts[index]; |
| 531 | |
| 532 | if ( |
| 533 | finalHostNode && ( |
| 534 | noMoreHostParts || |
| 535 | node.key === '*' || |
| 536 | (index === u.hostParts.length - 1 && value === 'www') |
| 537 | ) |
| 538 | ) { |
| 539 | if (finalHostNode.data) { |
| 540 | push(finalHostNode.data); |
| 541 | if (breakOnFirstMatch) { |
| 542 | return; |
| 543 | } |
| 544 | } |
| 545 | matchPath(finalHostNode, 0); |
| 546 | } |
| 547 | |
| 548 | if (noMoreHostParts) { |
| 549 | return; |
| 550 | } |
| 551 | |
| 552 | const nodes = node.hostNodes; |
| 553 | const wildcardNode = nodes.get('*'); |
| 554 | if (wildcardNode) { |
| 555 | matchHost(wildcardNode, index + 1); |
| 556 | } |
| 557 | |
| 558 | if (breakOnFirstMatch && matches.length > 0) { |
| 559 | return; |
| 560 | } |
| 561 | |
| 562 | const keyNode = nodes.get(value); |
| 563 | if (keyNode) { |
| 564 | matchHost(keyNode, index + 1); |
| 565 | } |
| 566 | }; |
| 567 | |
| 568 | const matchPath = (node: URLTrieNode, index: number) => { |
| 569 | const finalPathNode = node.pathNodes.get(''); |
no test coverage detected