Huge News!Announcing our $40M Series B led by Abstract Ventures.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.8.1 to 0.8.2

7

create-distribution.js

@@ -5,2 +5,3 @@ import fs from 'fs/promises'

import { execSync } from 'child_process'
import brotliSize from 'brotli-size'

@@ -87,4 +88,8 @@ const currentFilePath = (new URL(import.meta.url)).pathname

// Readme
const brotliSizeBytes = brotliSize.sync(minifiedESData.code)
const fileSizeInKB = stats.size / 1024
const readmeWithSize = readmeSrc.replace(/{{ size }}/g, `${fileSizeInKB.toFixed(2)}KB`)
const readmeWithSize = readmeSrc
.replace(/{{ size }}/g, `${fileSizeInKB.toFixed(2)}KB`)
.replace(/{{ brotliSize }}/g, `${brotliSizeBytes} bytes`)
await fs.writeFile(paths.readmeRoot, readmeWithSize, 'utf8')

@@ -91,0 +96,0 @@ console.info(`Created ${paths.readmeRoot}`)

2

dist/db64-cjs.min.js

@@ -1,2 +0,2 @@

const{isArray:isArray}=Array,connections=[],openDatabase=(e="default",t)=>new Promise(((r,s)=>{const n=window.indexedDB.open(e,1);n.onupgradeneeded=({target:e})=>{const{result:r}=e;t.forEach((e=>{if(!r.objectStoreNames.contains(e)){r.createObjectStore(e).onerror=e=>s(e.target.error)}}))},n.onsuccess=({target:e})=>{connections.push(n),r(e.result)},n.onerror=({target:e})=>{s(e.result)}})),setData=async(e,t,r,s,n)=>new Promise(((o,a)=>{try{const a=e.transaction([t],"readwrite").objectStore(t);if(n){const e=isArray(s)?()=>s.map(((e,t)=>a.put(e,t))):()=>Object.entries(s).map((([e,t])=>a.put(t,e)));o(Promise.all(e()))}else o(a.put(s,r));o(db64)}catch(e){a(e)}})),getData=async(e,t,r,s)=>new Promise((n=>{const o=e.transaction([t]).objectStore(t);if(s){const e={};o.openCursor().onsuccess=t=>{const s=t.target.result;s?(r.includes(s.key)&&(e[s.key]=s.value),s.continue()):n(e)}}else{const e=o.get(r);e.onsuccess=()=>n(e.result)}})),deleteData=async(e,t,r)=>new Promise(((s,n)=>{try{const n=e.transaction([t],"readwrite").objectStore(t);n.openCursor().onsuccess=e=>{const t=e.target.result;t&&((isArray(r)?r:[r]).includes(t.key)&&t.delete(),t.continue())},s(db64)}catch(e){n(e)}})),clearStore=(e,t)=>new Promise(((r,s)=>{const n=e.transaction([t],"readwrite").objectStore(t).clear();n.onsuccess=()=>r(db64),n.onerror=e=>s(e.target.error)})),deleteDB=e=>{const t=[];return new Promise(((r,s)=>{const n=indexedDB.deleteDatabase(e);n.onsuccess=()=>r(db64),n.onerror=({target:e})=>s(new Error(`Error deleting database: ${e.error}`)),n.onblocked=()=>{for(const r of connections)r.result.name===e&&(r.result.close(),t.push(e));t.includes(e)?r(db64):deleteDB(e)}}))},db64={create:async(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),isArray(t)?openDatabase(e,t):console.error(`${t} should be an array`)),use:(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),"string"!=typeof e&&console.error(`${t} should be a string`),{set:async(r,s)=>openDatabase(e,[t]).then((e=>setData(e,t,r,s))),setEntries:async r=>openDatabase(e,t).then((e=>setData(e,t,null,r,"entries"))),get:async r=>openDatabase(e,t).then((e=>getData(e,t,r))),getEntries:async r=>openDatabase(e,t).then((e=>getData(e,t,r,"entries"))),delete:async r=>openDatabase(e,t).then((e=>deleteData(e,t,r)))}),clear:async(e,t)=>openDatabase(e,t).then((e=>clearStore(e,t))),delete:async e=>deleteDB(e)};module.exports=db64;
const{isArray:isArray}=Array,connections=[],openDatabase=(e="default",t)=>new Promise(((r,s)=>{const n=window.indexedDB.open(e,1);n.onupgradeneeded=({target:e})=>{const{result:r}=e;t.forEach((e=>{if(!r.objectStoreNames.contains(e)){r.createObjectStore(e).onerror=e=>s(e.target.error)}}))},n.onsuccess=({target:e})=>{connections.push(n),r(e.result)},n.onerror=({target:e})=>s(e.result)})),setData=async(e,t,r,s,n)=>new Promise(((o,a)=>{try{const a=e.transaction([t],"readwrite").objectStore(t);if(n){const e=isArray(s)?()=>s.map(((e,t)=>a.put(e,t))):()=>Object.entries(s).map((([e,t])=>a.put(t,e)));o(Promise.all(e()))}else o(a.put(s,r))}catch(e){a(e)}})),getData=async(e,t,r,s)=>new Promise(((n,o)=>{const a=e.transaction([t]).objectStore(t);if(s){const e={},t=a.openCursor();t.onsuccess=t=>{const s=t.target.result;s?(r.includes(s.key)&&(e[s.key]=s.value),s.continue()):n(e)},t.onerror=e=>o(e)}else{const e=a.get(r);e.onsuccess=()=>n(e.result),e.onerror=e=>o(e)}})),deleteData=async(e,t,r)=>new Promise(((s,n)=>{try{const o=e.transaction([t],"readwrite").objectStore(t).openCursor();o.onsuccess=e=>{const t=e.target.result;t&&((isArray(r)?r:[r]).includes(t.key)&&t.delete(),t.continue())},o.onerror=e=>n(e),s(db64)}catch(e){n(e)}})),clearStore=(e,t)=>new Promise(((r,s)=>{const n=e.transaction([t],"readwrite").objectStore(t).clear();n.onsuccess=()=>r(db64),n.onerror=e=>s(e.target.error)})),deleteDB=e=>{const t=[];return new Promise(((r,s)=>{const n=indexedDB.deleteDatabase(e);n.onsuccess=()=>r(db64),n.onerror=e=>s(e),n.onblocked=()=>{for(const r of connections)r.result.name===e&&(r.result.close(),t.push(e));t.includes(e)?r(db64):deleteDB(e)}}))},db64={create:async(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),isArray(t)?openDatabase(e,t):console.error(`${t} should be an array`)),use:(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),"string"!=typeof e&&console.error(`${t} should be a string`),{set:async(r,s)=>openDatabase(e,[t]).then((e=>setData(e,t,r,s))),setEntries:async r=>openDatabase(e,t).then((e=>setData(e,t,null,r,"entries"))),get:async r=>openDatabase(e,t).then((e=>getData(e,t,r))),getEntries:async r=>openDatabase(e,t).then((e=>getData(e,t,r,"entries"))),delete:async r=>openDatabase(e,t).then((e=>deleteData(e,t,r)))}),clear:async(e,t)=>openDatabase(e,t).then((e=>clearStore(e,t))),delete:async e=>deleteDB(e)};module.exports=db64;
//# sourceMappingURL=db64-cjs.min.map

@@ -38,5 +38,3 @@ const { isArray } = Array

DBOpenRequest.onerror = ({ target }) => {
reject(target.result)
}
DBOpenRequest.onerror = ({ target }) => reject(target.result)
})

@@ -65,3 +63,2 @@

}
resolve(db64)
} catch (e) {

@@ -81,3 +78,3 @@ reject(e)

*/
const getData = async (database, storeName, key, entries) => new Promise((resolve) => {
const getData = async (database, storeName, key, entries) => new Promise((resolve, reject) => {
const objectStore = (database.transaction([storeName])).objectStore(storeName)

@@ -99,5 +96,8 @@

}
cursorRequest.onerror = e => reject(e)
} else {
const dataRequest = objectStore.get(key)
dataRequest.onsuccess = () => resolve(dataRequest.result)
dataRequest.onerror = e => reject(e)
}

@@ -128,2 +128,4 @@ })

}
cursorRequest.onerror = e => reject(e)
resolve(db64)

@@ -163,3 +165,3 @@ } catch (e) {

DBDeleteRequest.onerror = ({ target }) => reject(new Error(`Error deleting database: ${target.error}`))
DBDeleteRequest.onerror = e => reject(e)

@@ -207,3 +209,3 @@ DBDeleteRequest.onblocked = () => {

delete: async (keys) => openDatabase(name, storeName)
.then(database => deleteData(database, storeName, keys)),
.then(database => deleteData(database, storeName, keys))
}

@@ -210,0 +212,0 @@ },

@@ -1,2 +0,2 @@

const{isArray:isArray}=Array,connections=[],openDatabase=(e="default",t)=>new Promise(((r,s)=>{const n=window.indexedDB.open(e,1);n.onupgradeneeded=({target:e})=>{const{result:r}=e;t.forEach((e=>{if(!r.objectStoreNames.contains(e)){r.createObjectStore(e).onerror=e=>s(e.target.error)}}))},n.onsuccess=({target:e})=>{connections.push(n),r(e.result)},n.onerror=({target:e})=>{s(e.result)}})),setData=async(e,t,r,s,n)=>new Promise(((o,a)=>{try{const a=e.transaction([t],"readwrite").objectStore(t);if(n){const e=isArray(s)?()=>s.map(((e,t)=>a.put(e,t))):()=>Object.entries(s).map((([e,t])=>a.put(t,e)));o(Promise.all(e()))}else o(a.put(s,r));o(db64)}catch(e){a(e)}})),getData=async(e,t,r,s)=>new Promise((n=>{const o=e.transaction([t]).objectStore(t);if(s){const e={};o.openCursor().onsuccess=t=>{const s=t.target.result;s?(r.includes(s.key)&&(e[s.key]=s.value),s.continue()):n(e)}}else{const e=o.get(r);e.onsuccess=()=>n(e.result)}})),deleteData=async(e,t,r)=>new Promise(((s,n)=>{try{const n=e.transaction([t],"readwrite").objectStore(t);n.openCursor().onsuccess=e=>{const t=e.target.result;t&&((isArray(r)?r:[r]).includes(t.key)&&t.delete(),t.continue())},s(db64)}catch(e){n(e)}})),clearStore=(e,t)=>new Promise(((r,s)=>{const n=e.transaction([t],"readwrite").objectStore(t).clear();n.onsuccess=()=>r(db64),n.onerror=e=>s(e.target.error)})),deleteDB=e=>{const t=[];return new Promise(((r,s)=>{const n=indexedDB.deleteDatabase(e);n.onsuccess=()=>r(db64),n.onerror=({target:e})=>s(new Error(`Error deleting database: ${e.error}`)),n.onblocked=()=>{for(const r of connections)r.result.name===e&&(r.result.close(),t.push(e));t.includes(e)?r(db64):deleteDB(e)}}))},db64={create:async(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),isArray(t)?openDatabase(e,t):console.error(`${t} should be an array`)),use:(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),"string"!=typeof e&&console.error(`${t} should be a string`),{set:async(r,s)=>openDatabase(e,[t]).then((e=>setData(e,t,r,s))),setEntries:async r=>openDatabase(e,t).then((e=>setData(e,t,null,r,"entries"))),get:async r=>openDatabase(e,t).then((e=>getData(e,t,r))),getEntries:async r=>openDatabase(e,t).then((e=>getData(e,t,r,"entries"))),delete:async r=>openDatabase(e,t).then((e=>deleteData(e,t,r)))}),clear:async(e,t)=>openDatabase(e,t).then((e=>clearStore(e,t))),delete:async e=>deleteDB(e)};export default db64;
const{isArray:isArray}=Array,connections=[],openDatabase=(e="default",t)=>new Promise(((r,s)=>{const n=window.indexedDB.open(e,1);n.onupgradeneeded=({target:e})=>{const{result:r}=e;t.forEach((e=>{if(!r.objectStoreNames.contains(e)){r.createObjectStore(e).onerror=e=>s(e.target.error)}}))},n.onsuccess=({target:e})=>{connections.push(n),r(e.result)},n.onerror=({target:e})=>s(e.result)})),setData=async(e,t,r,s,n)=>new Promise(((o,a)=>{try{const a=e.transaction([t],"readwrite").objectStore(t);if(n){const e=isArray(s)?()=>s.map(((e,t)=>a.put(e,t))):()=>Object.entries(s).map((([e,t])=>a.put(t,e)));o(Promise.all(e()))}else o(a.put(s,r))}catch(e){a(e)}})),getData=async(e,t,r,s)=>new Promise(((n,o)=>{const a=e.transaction([t]).objectStore(t);if(s){const e={},t=a.openCursor();t.onsuccess=t=>{const s=t.target.result;s?(r.includes(s.key)&&(e[s.key]=s.value),s.continue()):n(e)},t.onerror=e=>o(e)}else{const e=a.get(r);e.onsuccess=()=>n(e.result),e.onerror=e=>o(e)}})),deleteData=async(e,t,r)=>new Promise(((s,n)=>{try{const o=e.transaction([t],"readwrite").objectStore(t).openCursor();o.onsuccess=e=>{const t=e.target.result;t&&((isArray(r)?r:[r]).includes(t.key)&&t.delete(),t.continue())},o.onerror=e=>n(e),s(db64)}catch(e){n(e)}})),clearStore=(e,t)=>new Promise(((r,s)=>{const n=e.transaction([t],"readwrite").objectStore(t).clear();n.onsuccess=()=>r(db64),n.onerror=e=>s(e.target.error)})),deleteDB=e=>{const t=[];return new Promise(((r,s)=>{const n=indexedDB.deleteDatabase(e);n.onsuccess=()=>r(db64),n.onerror=e=>s(e),n.onblocked=()=>{for(const r of connections)r.result.name===e&&(r.result.close(),t.push(e));t.includes(e)?r(db64):deleteDB(e)}}))},db64={create:async(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),isArray(t)?openDatabase(e,t):console.error(`${t} should be an array`)),use:(e,t)=>("string"!=typeof e&&console.error(`${e} should be a string`),"string"!=typeof e&&console.error(`${t} should be a string`),{set:async(r,s)=>openDatabase(e,[t]).then((e=>setData(e,t,r,s))),setEntries:async r=>openDatabase(e,t).then((e=>setData(e,t,null,r,"entries"))),get:async r=>openDatabase(e,t).then((e=>getData(e,t,r))),getEntries:async r=>openDatabase(e,t).then((e=>getData(e,t,r,"entries"))),delete:async r=>openDatabase(e,t).then((e=>deleteData(e,t,r)))}),clear:async(e,t)=>openDatabase(e,t).then((e=>clearStore(e,t))),delete:async e=>deleteDB(e)};export default db64;
//# sourceMappingURL=db64.min.map
{
"name": "db64",
"version": "0.8.1",
"version": "0.8.2",
"description": "A Practical IndexedDB API",

@@ -32,2 +32,3 @@ "main": "db64.js",

"devDependencies": {
"brotli-size": "^4.0.0",
"eslint": "^8.56.0",

@@ -34,0 +35,0 @@ "eslint-config-standard": "^17.1.0",

@@ -14,3 +14,3 @@ # db64

- No versioning
- 2.38KB minified
- 2.38KB minified | 783 bytes _(brotli)_

@@ -53,3 +53,3 @@ E.g.

> **_Just give me the builds_**
> - `git@github.com:julienetie/db64.git`
> - `git clone git@github.com:julienetie/db64.git`
> - `cd db64 && npm i`

@@ -56,0 +56,0 @@ > - `npm run prepublishOnly`

@@ -14,3 +14,3 @@ # db64

- No versioning
- {{ size }} minified
- {{ size }} minified | {{ brotliSize }} _(brotli)_

@@ -53,3 +53,3 @@ E.g.

> **_Just give me the builds_**
> - `git@github.com:julienetie/db64.git`
> - `git clone git@github.com:julienetie/db64.git`
> - `cd db64 && npm i`

@@ -56,0 +56,0 @@ > - `npm run prepublishOnly`

@@ -38,5 +38,3 @@ const { isArray } = Array

DBOpenRequest.onerror = ({ target }) => {
reject(target.result)
}
DBOpenRequest.onerror = ({ target }) => reject(target.result)
})

@@ -65,3 +63,2 @@

}
resolve(db64)
} catch (e) {

@@ -81,3 +78,3 @@ reject(e)

*/
const getData = async (database, storeName, key, entries) => new Promise((resolve) => {
const getData = async (database, storeName, key, entries) => new Promise((resolve, reject) => {
const objectStore = (database.transaction([storeName])).objectStore(storeName)

@@ -99,5 +96,8 @@

}
cursorRequest.onerror = e => reject(e)
} else {
const dataRequest = objectStore.get(key)
dataRequest.onsuccess = () => resolve(dataRequest.result)
dataRequest.onerror = e => reject(e)
}

@@ -128,2 +128,4 @@ })

}
cursorRequest.onerror = e => reject(e)
resolve(db64)

@@ -163,3 +165,3 @@ } catch (e) {

DBDeleteRequest.onerror = ({ target }) => reject(new Error(`Error deleting database: ${target.error}`))
DBDeleteRequest.onerror = e => reject(e)

@@ -207,3 +209,3 @@ DBDeleteRequest.onblocked = () => {

delete: async (keys) => openDatabase(name, storeName)
.then(database => deleteData(database, storeName, keys)),
.then(database => deleteData(database, storeName, keys))
}

@@ -210,0 +212,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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