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

fake-indexeddb

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

fake-indexeddb - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

13

lib/Index.js

@@ -52,5 +52,12 @@ 'use strict';

this.storeRecord = function (newRecord) {
var indexKey = extractKey(this.keyPath, newRecord.value);
if (indexKey === undefined) {
return;
var indexKey;
try {
indexKey = extractKey(this.keyPath, newRecord.value);
} catch (err) {
if (err.name === 'DataError') {
// Invalid key is not an actual error, just means we do not store an entry in this index
return;
}
throw err;
}

@@ -57,0 +64,0 @@

{
"name": "fake-indexeddb",
"version": "1.0.8",
"version": "1.0.9",
"description": "Fake IndexedDB: a pure JS in-memory implementation of the IndexedDB API",

@@ -34,14 +34,14 @@ "homepage": "https://github.com/dumbmatter/fakeIndexedDB",

"dependencies": {
"array.prototype.find": "1.0.0",
"array.prototype.findindex": "1.0.0",
"realistic-structured-clone": "0.0.2",
"setimmediate": "1.0.4"
"array.prototype.find": "^1.0.0",
"array.prototype.findindex": "^1.0.0",
"realistic-structured-clone": "^0.0.3",
"setimmediate": "^1.0.5"
},
"devDependencies": {
"browserify": "13.1.0",
"eslint": "3.2.2",
"mocha": "3.0.2",
"node-qunit-phantomjs": "1.4.0",
"qunitjs": "1.x"
"browserify": "^14.0.0",
"eslint": "^3.15.0",
"mocha": "^3.2.0",
"node-qunit-phantomjs": "^1.5.0",
"qunitjs": "^1.23.1"
}
}

@@ -11,7 +11,11 @@ # Fake IndexedDB [![Build Status](https://travis-ci.org/dumbmatter/fakeIndexedDB.svg?branch=master)](https://travis-ci.org/dumbmatter/fakeIndexedDB)

$ npm install fake-indexeddb
```sh
npm install fake-indexeddb
```
Otherwise, download [the bundled version](dist/fakeIndexedDB.js) and include it in your page like:
<script type="text/javascript" src="fakeIndexedDB.js"></script>
```html
<script type="text/javascript" src="fakeIndexedDB.js"></script>
```

@@ -26,34 +30,36 @@ If you're using AMD, you'll have to shim it.

var fakeIndexedDB = require('fake-indexeddb');
var FDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange');
```js
var fakeIndexedDB = require('fake-indexeddb');
var FDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange');
var request = fakeIndexedDB.open('test', 3);
request.onupgradeneeded = function () {
var db = request.result;
var store = db.createObjectStore("books", {keyPath: "isbn"});
store.createIndex("by_title", "title", {unique: true});
var request = fakeIndexedDB.open('test', 3);
request.onupgradeneeded = function () {
var db = request.result;
var store = db.createObjectStore("books", {keyPath: "isbn"});
store.createIndex("by_title", "title", {unique: true});
store.put({title: "Quarry Memories", author: "Fred", isbn: 123456});
store.put({title: "Water Buffaloes", author: "Fred", isbn: 234567});
store.put({title: "Bedrock Nights", author: "Barney", isbn: 345678});
}
request.onsuccess = function (event) {
var db = event.target.result;
store.put({title: "Quarry Memories", author: "Fred", isbn: 123456});
store.put({title: "Water Buffaloes", author: "Fred", isbn: 234567});
store.put({title: "Bedrock Nights", author: "Barney", isbn: 345678});
}
request.onsuccess = function (event) {
var db = event.target.result;
var tx = db.transaction("books");
var tx = db.transaction("books");
tx.objectStore("books").index("by_title").get("Quarry Memories").addEventListener('success', function (event) {
console.log('From index:', event.target.result);
});
tx.objectStore("books").openCursor(FDBKeyRange.lowerBound(200000)).onsuccess = function (event) {
var cursor = event.target.result;
if (cursor) {
console.log('From cursor:', cursor.value);
cursor.continue();
}
};
tx.oncomplete = function () {
console.log('All done!');
};
tx.objectStore("books").index("by_title").get("Quarry Memories").addEventListener('success', function (event) {
console.log('From index:', event.target.result);
});
tx.objectStore("books").openCursor(FDBKeyRange.lowerBound(200000)).onsuccess = function (event) {
var cursor = event.target.result;
if (cursor) {
console.log('From cursor:', cursor.value);
cursor.continue();
}
};
tx.oncomplete = function () {
console.log('All done!');
};
};
```

@@ -60,0 +66,0 @@ Variable names of all the objects are like the normal IndexedDB ones except with F replacing I, e.g. `FDBIndex` instead of `IDBIndex`.

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