Skip to content

Commit

Permalink
perf(index): use optional chaining
Browse files Browse the repository at this point in the history
Signed-off-by: Frazer Smith <[email protected]>
  • Loading branch information
Fdawgs authored Jan 4, 2025
1 parent ea9dbf7 commit 1bd3a68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function fastifyCors (fastify, opts, next) {
}

function handleCorsOptionsDelegator (optionsResolver, fastify, opts, next) {
const hook = (opts && opts.hook) || defaultOptions.hook
const hook = opts?.hook || defaultOptions.hook
validateHook(hook, next)
if (optionsResolver.length === 2) {
if (hookWithPayload.indexOf(hook) !== -1) {
Expand Down

0 comments on commit 1bd3a68

Please sign in to comment.