Socket
Socket
Sign inDemoInstall

idb-keyval

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idb-keyval - npm Package Compare versions

Comparing version 2.5.0 to 3.0.0

dist/idb-keyval-cjs.js

68

package.json
{
"name": "idb-keyval",
"version": "2.5.0",
"description": "A super-simple-small keyval store built on top of IndexedDB",
"main": "idb-keyval.js",
"typings": "typings.d.ts",
"scripts": {
"build": "uglifyjs idb-keyval.js --screw-ie8 -mc --output dist/idb-keyval-min.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jakearchibald/idb-keyval.git"
},
"keywords": [
"idb",
"indexeddb",
"store",
"keyval",
"localstorage",
"storage",
"promise"
],
"author": "Jake Archibald",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/jakearchibald/idb-keyval/issues"
},
"homepage": "https://github.com/jakearchibald/idb-keyval#readme",
"devDependencies": {
"uglify-js": "^2.7.0"
}
"name": "idb-keyval",
"version": "3.0.0",
"description": "A super-simple-small keyval store built on top of IndexedDB",
"main": "./dist/idb-keyval-cjs.js",
"module": "./dist/idb-keyval.mjs",
"types": "./dist/idb-keyval.d.ts",
"scripts": {
"build": "del dist && rollup -c && uglifyjs --compress --mangle -o dist/idb-keyval-iife.min.js dist/idb-keyval-iife.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jakearchibald/idb-keyval.git"
},
"keywords": [
"idb",
"indexeddb",
"store",
"keyval",
"localstorage",
"storage",
"promise"
],
"author": "Jake Archibald",
"contributors": [
"Benny Powers"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/jakearchibald/idb-keyval/issues"
},
"homepage": "https://github.com/jakearchibald/idb-keyval#readme",
"devDependencies": {
"del-cli": "^1.1.0",
"rollup": "^0.56.5",
"rollup-plugin-typescript2": "^0.12.0",
"typescript": "^2.7.2",
"uglify-es": "^3.3.9"
}
}

@@ -8,3 +8,3 @@ # IDB-Keyval

[localForage](https://github.com/localForage/localForage) offers similar functionality, but supports older browsers with broken/absent IDB implementations. Because of that, it's 6k, whereas idb-keyval is less than 500 bytes. Pick whichever works best for you!
[localForage](https://github.com/localForage/localForage) offers similar functionality, but supports older browsers with broken/absent IDB implementations. Because of that, it's 7.4k, whereas idb-keyval is ~550 bytes. Also, it's tree-shaking friendly, so you'll probably end up using few than Pick whichever works best for you!

@@ -18,4 +18,6 @@ This is only a keyval store. If you need to do more complex things like iteration & indexing, check out [IDB on NPM](https://www.npmjs.com/package/idb) (a little heavier at 1.7k). The first example in its README is how to recreate this library.

```js
idbKeyval.set('hello', 'world');
idbKeyval.set('foo', 'bar');
import { set } from 'idb-keyval';
set('hello', 'world');
set('foo', 'bar');
```

@@ -28,3 +30,5 @@

```js
idbKeyval.set('hello', 'world')
import { set } from 'idb-keyval';
set('hello', 'world')
.then(() => console.log('It worked!'))

@@ -37,4 +41,6 @@ .catch(err => console.log('It failed!', err));

```js
import { get } from 'idb-keyval';
// logs: "world"
idbKeyval.get('hello').then(val => console.log(val));
get('hello').then(val => console.log(val));
```

@@ -47,10 +53,14 @@

```js
import { keys } from 'idb-keyval';
// logs: ["hello", "foo"]
idbKeyval.keys().then(keys => console.log(keys));
keys().then(keys => console.log(keys));
```
### delete:
### del:
```js
idbKeyval.delete('hello');
import { del } from 'idb-keyval';
del('hello');
```

@@ -61,5 +71,18 @@

```js
idbKeyval.clear();
import { clear } from 'idb-keyval';
clear();
```
### Custom stores:
By default, the methods above use an IndexedDB database named `keyval-store` and an object store named `keyval`. You can create your own store, and pass it as an additional parameter to any of the above methods:
```js
import { Store, set } from 'idb-keyval';
const customStore = new Store('custom-db-name', 'custom-store-name');
set('foo', 'bar', customStore);
```
That's it!

@@ -69,3 +92,3 @@

### Via npm
### Via npm + webpack/rollup

@@ -79,3 +102,3 @@ ```sh

```js
const idbKeyval = require('idb-keyval');
import { get, set } from 'idb-keyval';
```

@@ -85,4 +108,3 @@

`idb-keyval.js` is a valid JS module.
`dist/idb-keyval.iffe.js` can be used in browsers that don't support modules. `idbKeyval` is created as a global.
* `dist/idb-keyval.mjs` is a valid JS module.
* `dist/idb-keyval-iife.js` can be used in browsers that don't support modules. `idbKeyval` is created as a global.
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