MCPcopy
hub / github.com/fastify/fastify / buildRouterOptions

Function buildRouterOptions

lib/route.js:669–687  ·  lib/route.js::buildRouterOptions
(options, defaultOptions)

Source from the content-addressed store, hash-verified

667}
668
669function buildRouterOptions (options, defaultOptions) {
670 const routerOptions = options.routerOptions == null
671 ? Object.create(null)
672 : Object.assign(Object.create(null), options.routerOptions)
673
674 const usedDeprecatedOptions = routerKeys.filter(key => Object.hasOwn(options, key))
675
676 if (usedDeprecatedOptions.length > 0) {
677 FSTDEP022(usedDeprecatedOptions.join(class="st">', '))
678 }
679
680 for (const key of routerKeys) {
681 if (!Object.hasOwn(routerOptions, key)) {
682 routerOptions[key] = options[key] ?? defaultOptions[key]
683 }
684 }
685
686 return routerOptions
687}
688
689/**
690 * Used within the route handler as a `net.Socket.close` event handler.

Callers 1

processOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected