Skip to content

Commit 250b891

Browse files
authored
chore: use destructuring to extract option variables (#227)
Signed-off-by: Pelle Wessman <[email protected]>
1 parent 054f094 commit 250b891

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

index.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,21 @@ function fastifyOauth2 (fastify, options, next) {
7474
fastify.register(require('@fastify/cookie'))
7575
}
7676

77-
const name = options.name
78-
const credentials = options.credentials
79-
const callbackUri = options.callbackUri
80-
const callbackUriParams = options.callbackUriParams || {}
81-
const tokenRequestParams = options.tokenRequestParams || {}
82-
const scope = options.scope
83-
const generateStateFunction = options.generateStateFunction || defaultGenerateStateFunction
84-
const checkStateFunction = options.checkStateFunction || defaultCheckStateFunction
77+
const {
78+
name,
79+
credentials,
80+
callbackUri,
81+
callbackUriParams = {},
82+
tokenRequestParams = {},
83+
scope,
84+
generateStateFunction = defaultGenerateStateFunction,
85+
checkStateFunction = defaultCheckStateFunction,
86+
startRedirectPath,
87+
tags = [],
88+
schema = { tags }
89+
} = options
90+
8591
const generateCallbackUriParams = (credentials.auth && credentials.auth[kGenerateCallbackUriParams]) || defaultGenerateCallbackUriParams
86-
const startRedirectPath = options.startRedirectPath
87-
const tags = options.tags || []
88-
const schema = options.schema || { tags }
8992
const cookieOpts = Object.assign({ httpOnly: true, sameSite: 'lax' }, options.cookie)
9093

9194
function generateAuthorizationUri (request, reply) {

0 commit comments

Comments
 (0)