Skip to content

Commit

Permalink
refactor: exit early
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Mar 23, 2024
1 parent 24f3ef0 commit ecdd059
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Expand Up @@ -44,11 +44,11 @@ const cacheableResponse = ({

return async opts => {
const { req, res } = opts
if (res.writableEnded) return

const [raw, { forceExpiration, hasValue, key, isExpired, isStale }] =
await memoGet(opts)

if (res.writableEnded) return

const result = (await decompress(raw)) || {}
const isHit = !forceExpiration && !isExpired && hasValue

Expand Down

0 comments on commit ecdd059

Please sign in to comment.