Skip to content

Commit 7ba7b7f

Browse files
authored
perf(index): use optional chaining (#318)
Signed-off-by: Frazer Smith <[email protected]>
1 parent e6b2811 commit 7ba7b7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ function fastifyWebsocket (fastify, opts, next) {
2323
}
2424

2525
let preClose = defaultPreClose
26-
if (opts && opts.preClose) {
26+
if (opts?.preClose) {
2727
if (typeof opts.preClose !== 'function') {
2828
return next(new Error('invalid preClose function'))
2929
}
3030

3131
preClose = opts.preClose
3232
}
3333

34-
if (opts.options && opts.options.noServer) {
34+
if (opts.options?.noServer) {
3535
return next(new Error("fastify-websocket doesn't support the ws noServer option. If you want to create a websocket server detatched from fastify, use the ws library directly."))
3636
}
3737

0 commit comments

Comments
 (0)