MCPcopy Create free account
hub / github.com/fastify/fastify / buildRouterOptions

Function buildRouterOptions

lib/route.js:661–679  ·  view source on GitHub ↗
(options, defaultOptions)

Source from the content-addressed store, hash-verified

659}
660
661function 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.

Callers 1

processOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected