fake-indexeddb
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -1,2 +0,1 @@ | ||
require("core-js/shim"); | ||
var fakeIndexedDB = require("./build/fakeIndexedDB").default; | ||
@@ -20,6 +19,6 @@ var FDBCursor = require("./build/FDBCursor").default; | ||
: typeof WorkerGlobalScope !== "undefined" | ||
? self | ||
: typeof global !== "undefined" | ||
? global | ||
: Function("return this;")(); | ||
? self | ||
: typeof global !== "undefined" | ||
? global | ||
: Function("return this;")(); | ||
@@ -26,0 +25,0 @@ globalVar.indexedDB = fakeIndexedDB; |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -15,6 +15,6 @@ "use strict"; | ||
})(); | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -25,2 +25,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -150,4 +151,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
FDBDatabase.prototype.transaction = function (storeNames, mode) { | ||
var e_1, _a; | ||
var _this = this; | ||
var e_1, _a; | ||
mode = mode !== undefined ? mode : "readonly"; | ||
@@ -154,0 +155,0 @@ if (mode !== "readonly" && |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ var __read = (this && this.__read) || function (o, n) { |
@@ -15,6 +15,6 @@ "use strict"; | ||
})(); | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -25,2 +25,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -56,4 +57,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
FDBTransaction.prototype._abort = function (errName) { | ||
var e_1, _a, e_2, _b; | ||
var _this = this; | ||
var e_1, _a, e_2, _b; | ||
try { | ||
@@ -60,0 +61,0 @@ for (var _c = __values(this._rollbackLog.reverse()), _d = _c.next(); !_d.done; _d = _c.next()) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("core-js/shim"); | ||
var fakeIndexedDB_1 = require("./fakeIndexedDB"); | ||
module.exports = fakeIndexedDB_1.default; |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -94,4 +95,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
ObjectStore.prototype.storeRecord = function (newRecord, noOverwrite, rollbackLog) { | ||
var e_3, _a; | ||
var _this = this; | ||
var e_3, _a; | ||
if (this.keyPath !== null) { | ||
@@ -178,4 +179,4 @@ var key = extractKey_1.default(this.keyPath, newRecord.value); | ||
ObjectStore.prototype.deleteRecord = function (key, rollbackLog) { | ||
var e_4, _a, e_5, _b; | ||
var _this = this; | ||
var e_4, _a, e_5, _b; | ||
var deletedRecords = this.records.delete(key); | ||
@@ -218,4 +219,4 @@ if (rollbackLog) { | ||
ObjectStore.prototype.clear = function (rollbackLog) { | ||
var e_6, _a, e_7, _b; | ||
var _this = this; | ||
var e_6, _a, e_7, _b; | ||
var deletedRecords = this.records.clear(); | ||
@@ -222,0 +223,0 @@ if (rollbackLog) { |
@@ -79,5 +79,5 @@ "use strict"; | ||
RecordStore.prototype.values = function (range, direction) { | ||
var _a; | ||
var _this = this; | ||
if (direction === void 0) { direction = "next"; } | ||
var _a; | ||
return _a = {}, | ||
@@ -84,0 +84,0 @@ _a[Symbol.iterator] = function () { |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -11,2 +11,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
@@ -13,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,1 +1,5 @@ | ||
# 3.0.0 (2019-11-15) | ||
* Stopped importing core-js by default. This means that, for people using fake-indexeddb in really old environments like PhantomJS, they will now need to import core-js like `require("core-js/stable");` (or something similar) before importing fake-indexeddb. | ||
# 2.1.1 (2019-06-05) | ||
@@ -2,0 +6,0 @@ |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBCursor").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBCursorWithValue").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBDatabase").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBFactory").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBIndex").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBKeyRange").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBObjectStore").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBOpenDBRequest").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBRequest").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBTransaction").default; |
@@ -5,3 +5,2 @@ // This file is needed to maintain API compatibility with fake-indexeddb 1.x because of | ||
require("core-js/shim"); | ||
module.exports = require("../build/FDBVersionChangeEvent").default; |
{ | ||
"name": "fake-indexeddb", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "Fake IndexedDB: a pure JS in-memory implementation of the IndexedDB API", | ||
@@ -33,3 +33,3 @@ "homepage": "https://github.com/dumbmatter/fakeIndexedDB", | ||
"test-w3c": "node src/test/web-platform-tests/run-all.js", | ||
"test": "npm run lint && npm run build && npm run test-w3c && npm run test-mocha && npm run test-qunit" | ||
"test": "npm run lint && npm run build && node test/test.js && npm run test-w3c && npm run test-mocha && npm run test-qunit" | ||
}, | ||
@@ -44,3 +44,2 @@ "author": "Jeremy Scheff <jdscheff@gmail.com> (http://dumbmatter.com/)", | ||
"dependencies": { | ||
"core-js": "^2.4.1", | ||
"realistic-structured-clone": "^2.0.1", | ||
@@ -50,16 +49,17 @@ "setimmediate": "^1.0.5" | ||
"devDependencies": { | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^11.11.3", | ||
"browserify": "^16.2.3", | ||
"glob": "^7.1.3", | ||
"husky": "^1.1.2", | ||
"lint-staged": "^8.1.5", | ||
"mocha": "^6.0.2", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.12.7", | ||
"browserify": "^16.5.0", | ||
"core-js": "^3.4.1", | ||
"glob": "^7.1.6", | ||
"husky": "^3.0.9", | ||
"lint-staged": "^9.4.3", | ||
"mocha": "^6.2.2", | ||
"node-qunit-phantomjs": "^1.6.3", | ||
"prettier": "^1.14.3", | ||
"prettier": "^1.19.1", | ||
"qunitjs": "^1.23.1", | ||
"semver": "^5.6.0", | ||
"tslint": "^5.11.0", | ||
"semver": "^6.3.0", | ||
"tslint": "^5.20.1", | ||
"tslint-config-prettier": "^1.15.0", | ||
"typescript": "3.3.3333" | ||
"typescript": "3.7.2" | ||
}, | ||
@@ -66,0 +66,0 @@ "husky": { |
@@ -66,4 +66,31 @@ # fake-indexeddb [![Build Status](https://travis-ci.org/dumbmatter/fakeIndexedDB.svg?branch=master)](https://travis-ci.org/dumbmatter/fakeIndexedDB) | ||
When importing individual classes directly (like `var IDBKeyRange = require("fake-indexeddb/lib/FDBKeyRange");` above), file names of all the objects are like the normal IndexedDB ones except with F replacing I, e.g. `FDBIndex` instead of `IDBIndex`. | ||
When importing individual classes directly (like `var IDBKeyRange = | ||
require("fake-indexeddb/lib/FDBKeyRange");` above), file names of all the objects are like the | ||
normal IndexedDB ones except with F replacing I, e.g. `FDBIndex` instead of `IDBIndex`. | ||
### With Jest | ||
To use this on a single Jest test suite, require `fake-indexeddb/auto` at the beginning of the test | ||
file, as described above. | ||
To use it on all Jest tests without having to require it in each file, add the auto setup script to the `setupFiles` in your Jest config: | ||
```json | ||
"jest": { | ||
... | ||
"setupFiles": [ | ||
"fake-indexeddb/auto" | ||
] | ||
} | ||
``` | ||
### With PhantomJS and other really old environments | ||
PhantomJS (and other really old environments) are missing tons of modern JavaScript features. In fact, that may be why you use fake-indexeddb in such an environment! Prior to v3.0.0, fake-indexeddb imported core-js and automatically applied its polyfills. However, since most fake-indexeddb users are not using really old environments, I got rid of that runtime dependency in v3.0.0. To work around that, you can import core-js yourself before you import fake-indexeddb, like: | ||
```js | ||
require("core-js/stable"); | ||
var indexedDB = require("fake-indexeddb"); | ||
``` | ||
## Quality | ||
@@ -73,9 +100,9 @@ | ||
Implementation | Percentage of files that pass completely | ||
--- | --- | ||
Chrome 73 | 99% | ||
Firefox 65 | 97% | ||
Safari 12 | 92% | ||
fake-indexeddb 2.1.0 | 87% | ||
Edge 18 | 61% | ||
| Implementation | Percentage of files that pass completely | | ||
| -------------------- | ---------------------------------------- | | ||
| Chrome 73 | 99% | | ||
| Firefox 65 | 97% | | ||
| Safari 12 | 92% | | ||
| fake-indexeddb 3.0.0 | 87% | | ||
| Edge 18 | 61% | | ||
@@ -82,0 +109,0 @@ For browsers, I ran http://w3c-test.org/tools/runner/index.html and counted the passes. For fake-indexeddb, I ran `npm run test-w3c`. |
181340
2
128
15
3754
- Removedcore-js@^2.4.1
- Removedcore-js@2.6.12(transitive)