New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

db64

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db64 - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

49

db64.js

@@ -19,3 +19,2 @@ let dbName = 'default'

db.onerror = e => reject(e.target.result)
return db

@@ -44,2 +43,3 @@ })

const getData = async (db, storeName, key, entries) => {
console.log('getData')
return new Promise((resolve) => {

@@ -73,6 +73,4 @@ const transaction = db.transaction([storeName])

const deleteData = async (db, storeName, key) => {
const keyArr = isArray(key) ? key : [key]
try {
const transaction = db.transaction([storeName], 'readwrite')
const objectStore = transaction.objectStore(storeName)
const objectStore = (db.transaction([storeName], 'readwrite')).objectStore(storeName)
const cursorRequest = objectStore.openCursor()

@@ -84,3 +82,3 @@

if (cursor) {
if (keyArr.includes(cursor.key)) cursor.delete()
if ((isArray(key) ? key : [key]).includes(cursor.key)) cursor.delete()
cursor.continue()

@@ -92,3 +90,2 @@ }

}
return await db64

@@ -99,4 +96,3 @@ }

return new Promise((resolve, reject) => {
const transaction = db.transaction([storeName], 'readwrite')
const objectStore = transaction.objectStore(storeName)
const objectStore = (db.transaction([storeName], 'readwrite')).objectStore(storeName)
const objectStoreRequest = objectStore.clear()

@@ -110,24 +106,19 @@

const db64 = {
from: storeName => {
store: storeName => {
return {
set: async (key, value) => {
return openDB(storeName).then(db => setData(db, storeName, key, value))
.catch(setDataError)
},
setEntries: async (value) => {
return openDB(storeName).then(db => setData(db, storeName, null, value, 'entries'))
.catch(setDataError)
},
get: async key => {
return openDB(storeName).then(db => getData(db, storeName, key))
.catch(getDataError)
},
getEntries: async (keys) => {
return openDB(storeName).then(db => getData(db, storeName, keys, 'entries'))
.catch(getDataError)
},
delete: async (keys) => {
return openDB(storeName).then(db => deleteData(db, storeName, keys))
.catch(console.error)
}
set: async (key, value) => openDB(storeName)
.then(db => setData(db, storeName, key, value))
.catch(setDataError),
setEntries: async (value) => openDB(storeName)
.then(db => setData(db, storeName, null, value, 'entries'))
.catch(setDataError),
get: async key => openDB(storeName)
.then(db => getData(db, storeName, key))
.catch(getDataError),
getEntries: async (keys) => openDB(storeName)
.then(db => getData(db, storeName, keys, 'entries'))
.catch(getDataError),
delete: async (keys) => openDB(storeName)
.then(db => deleteData(db, storeName, keys))
.catch(console.error)
}

@@ -134,0 +125,0 @@ },

{
"name": "db64",
"version": "0.2.0",
"version": "0.3.0",
"description": "A Practical IndexedDB API",

@@ -5,0 +5,0 @@ "main": "db64.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc