Skip to content

Commit

Permalink
fix: exit early if undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jul 29, 2021
1 parent f73a3f3 commit 2926ab6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class Keyv extends EventEmitter {

async get (key, { raw: asRaw = false } = {}) {
const raw = await this.store.get(this._getKeyPrefix(key))
if (raw === undefined) return undefined

const data = typeof raw === 'string' ? await this.deserialize(raw) : raw

if (typeof data.expires === 'number' && Date.now() > data.expires) {
Expand Down

0 comments on commit 2926ab6

Please sign in to comment.