Skip to content

Commit

Permalink
Merge pull request #408 from janicduplessis/@janic/idb-fix
Browse files Browse the repository at this point in the history
Fix IDBKeyVal get returning undefined instead of null
  • Loading branch information
mountiny authored Oct 31, 2023
2 parents 40c5b68 + 6f77ac9 commit 3cdc192
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/storage/providers/IDBKeyVal.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ const provider = {
* @param {String} key
* @return {Promise<*>}
*/
getItem: key => get(key, getCustomStore()),
getItem: key => get(key, getCustomStore())

// idb-keyval returns undefined for missing items, but this needs to return null so that idb-keyval does the same thing as SQLiteStorage.
.then(val => (val === undefined ? null : val)),

/**
* Remove given key and it's value from storage
Expand Down

0 comments on commit 3cdc192

Please sign in to comment.