Browse Source

fix: exit early if undefined

master
Kiko Beats 3 years ago
parent
commit
2926ab697e
No known key found for this signature in database GPG Key ID: 8FA93B22CCF04B96
  1. 2
      packages/core/src/index.js

2
packages/core/src/index.js

@ -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) {

Loading…
Cancel
Save