Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

idb

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idb - npm Package Compare versions

Comparing version 5.0.4 to 5.0.5

32

build/test/open.js

@@ -28,2 +28,34 @@ import { b as openDB, c as dbName, g as getNextVersion, w as wrap, u as unwrap, o as openDBWithSchema, d as deleteDatabase } from './utils-66091b10.js';

});
test('open without version - upgrade should not run', async () => {
let upgradeRun = false;
db = (await openDB(dbName, undefined, {
upgrade(db, oldVersion, newVersion, tx) {
upgradeRun = true;
},
}));
assert.isFalse(upgradeRun, 'upgrade not run');
assert.strictEqual(db.version, 1);
});
test('open without version - database never existed', async () => {
db = (await openDB(dbName));
assert.strictEqual(db.version, 1);
});
test('open with undefined version - database never existed', async () => {
db = (await openDB(dbName, undefined, {}));
assert.strictEqual(db.version, 1);
});
test('open without version - database previously created', async () => {
const version = getNextVersion();
db = (await openDB(dbName, version));
db.close();
db = (await openDB(dbName));
assert.strictEqual(db.version, version);
});
test('open with undefined version - database previously created', async () => {
const version = getNextVersion();
db = (await openDB(dbName, version));
db.close();
db = (await openDB(dbName, undefined, {}));
assert.strictEqual(db.version, version);
});
test('upgrade - schemaless', async () => {

@@ -30,0 +62,0 @@ let upgradeRun = false;

2

package.json
{
"name": "idb",
"version": "5.0.4",
"version": "5.0.5",
"description": "A small wrapper that makes IndexedDB usable",

@@ -5,0 +5,0 @@ "main": "build/cjs/index.js",

@@ -22,2 +22,4 @@ # IndexedDB with usability.

## Using npm
```sh

@@ -37,4 +39,6 @@ npm install idb

Or, use it directly via unpkg:
## Directly In a browser
### Using the modules method directly via unpkg:
```html

@@ -50,2 +54,13 @@ <script type="module">

### Using external script reference
```html
<script src="https://unpkg.com/idb@5/build/iife/index-min.js"></script>
<script>
async function doDatabaseStuff() {
const db = await idb.openDB(…);
}
</script>
```
# Changes

@@ -79,3 +94,3 @@

- `name`: Name of the database.
- `version`: Schema version.
- `version` (optional): Schema version, or `undefined` to open the current version.
- `upgrade` (optional): Called if this version of the database has never been opened before. Use it to specify the schema for the database. This is similar to the [`upgradeneeded` event](https://developer.mozilla.org/en-US/docs/Web/API/IDBOpenDBRequest/upgradeneeded_event) in plain IndexedDB.

@@ -82,0 +97,0 @@ - `db`: An enhanced `IDBDatabase`.

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