Skip to content

Commit 7126445

Browse files
authored
refactor(index): remove useless else blocks after returns (#254)
1 parent 00249da commit 7126445

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ async function fastifyHelmet (fastify, options) {
4545

4646
// We decorate the reply with a fallback to the route scoped helmet options
4747
return replyDecorators(request, reply, mergedHelmetConfiguration, enableRouteCSPNonces)
48-
} else {
49-
// We decorate the reply with a fallback to the global helmet options
50-
return replyDecorators(request, reply, globalConfiguration, enableCSPNonces)
5148
}
49+
50+
// We decorate the reply with a fallback to the global helmet options
51+
return replyDecorators(request, reply, globalConfiguration, enableCSPNonces)
5252
})
5353

5454
fastify.addHook('onRequest', (request, reply, next) => {
@@ -69,14 +69,14 @@ async function fastifyHelmet (fastify, options) {
6969
}
7070

7171
return next()
72-
} else if (isGlobal) {
72+
}
73+
if (isGlobal) {
7374
// if the plugin is set globally (meaning that all the routes will be decorated)
7475
// As the endpoint, does not have a custom helmet configuration, use the global one.
7576
return buildHelmetOnRoutes(request, reply, globalConfiguration, enableCSPNonces)
76-
} else {
77-
// if the plugin is not global we can skip the route
7877
}
7978

79+
// if the plugin is not global we can skip the route
8080
return next()
8181
})
8282
}

0 commit comments

Comments
 (0)