| 659 | } |
| 660 | |
| 661 | function buildRouterOptions (options, defaultOptions) { |
| 662 | const routerOptions = options.routerOptions == null |
| 663 | ? Object.create(null) |
| 664 | : Object.assign(Object.create(null), options.routerOptions) |
| 665 | |
| 666 | const usedDeprecatedOptions = routerKeys.filter(key => Object.hasOwn(options, key)) |
| 667 | |
| 668 | if (usedDeprecatedOptions.length > 0) { |
| 669 | FSTDEP022(usedDeprecatedOptions.join(', ')) |
| 670 | } |
| 671 | |
| 672 | for (const key of routerKeys) { |
| 673 | if (!Object.hasOwn(routerOptions, key)) { |
| 674 | routerOptions[key] = options[key] ?? defaultOptions[key] |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | return routerOptions |
| 679 | } |
| 680 | |
| 681 | /** |
| 682 | * Used within the route handler as a `net.Socket.close` event handler. |