Skip to content

Commit

Permalink
refactor: use Object.entries/.fromEntries
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jul 5, 2022
1 parent 7a69a46 commit 18c2b41
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/events/authValidateContext.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Boom from '@hapi/boom'
import { log } from '@serverless/utils/log.js'

const { keys, values } = Object
const { entries, fromEntries, values } = Object

function internalServerError(message) {
const errorType = 'AuthorizerConfigurationException'
Expand All @@ -22,11 +22,9 @@ function isValidContext(context) {
}

function transform(context) {
keys(context).forEach((i) => {
context[i] = context[i].toString()
})

return context
return fromEntries(
entries(context).map(([key, value]) => [key, String(value)]),
)
}

export default function authValidateContext(context, authFunName) {
Expand Down

0 comments on commit 18c2b41

Please sign in to comment.