Skip to content

Commit e53a89c

Browse files
committed
refactor(jwt): removes redundant condition checks
1 parent 5216117 commit e53a89c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/utils/jwt/jwt.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ export const verify = async (
151151
if (!payload.aud) {
152152
throw new JwtPayloadRequiresAud(payload)
153153
}
154-
}
155154

156-
if (payload.aud) {
157155
const audiences = Array.isArray(payload.aud) ? payload.aud : [payload.aud]
158156
const matched = audiences.some((aud): boolean => {
159157
if (opts.aud instanceof RegExp && opts.aud.test(aud)) {
@@ -169,7 +167,7 @@ export const verify = async (
169167
}
170168
return false
171169
})
172-
if (opts.aud && !matched) {
170+
if (!matched) {
173171
throw new JwtTokenAudience(opts.aud, payload.aud)
174172
}
175173
}

0 commit comments

Comments
 (0)