Skip to content

Commit

Permalink
perf: use spread over object.assign (#185)
Browse files Browse the repository at this point in the history
* perf: use spread over object.assign

* chore: fix linting

* Update verify-bearer-auth-factory.js

Co-authored-by: Aras Abbasi <aras.abbasi@googlemail.com>
Signed-off-by: Frazer Smith <frazer.dev@icloud.com>

---------

Signed-off-by: Frazer Smith <frazer.dev@icloud.com>
Co-authored-by: Aras Abbasi <aras.abbasi@googlemail.com>
  • Loading branch information
Fdawgs and Uzlopak authored Jul 19, 2024
1 parent bcb7f4b commit 4bf28d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const verifyBearerAuthFactory = require('./lib/verify-bearer-auth-factory')
const { FST_BEARER_AUTH_INVALID_LOG_LEVEL } = require('./lib/errors')

function fastifyBearerAuth (fastify, options, done) {
options = Object.assign({ addHook: true, verifyErrorLogLevel: 'error' }, options)
options = { addHook: true, verifyErrorLogLevel: 'error', ...options }

if (
Object.prototype.hasOwnProperty.call(fastify.log, 'error') === false ||
Expand Down
2 changes: 1 addition & 1 deletion lib/verify-bearer-auth-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const defaultOptions = {
}

module.exports = function verifyBearerAuthFactory (options, done) {
const _options = Object.assign({}, defaultOptions, options)
const _options = { ...defaultOptions, ...options }
if (_options.keys instanceof Set) {
_options.keys = Array.from(_options.keys)
} else if (Array.isArray(_options.keys)) {
Expand Down

0 comments on commit 4bf28d3

Please sign in to comment.