fake-indexeddb
Advanced tools
Comparing version 4.0.0-beta.5 to 4.0.0-beta.6
@@ -8,3 +8,2 @@ "use strict"; | ||
// Subclass Array to get nice behaviors like destructuring, but delete various Array methods that don't exist on DOMStringList https://github.com/dumbmatter/fakeIndexedDB/issues/66#issuecomment-922407403 | ||
class FakeDOMStringList extends Array { | ||
@@ -38,18 +37,52 @@ contains(value) { | ||
} // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array | ||
} // Would be nice to remove these properties to fix https://github.com/dumbmatter/fakeIndexedDB/issues/66 but for some reason it breaks Dexie - see test/dexie.js and FakeDOMStringList tests | ||
/* | ||
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array | ||
const arrayPropertiesToDelete = ["from", "isArray", "of"]; | ||
const arrayMethodsToDelete = ["at", "concat", "copyWithin", "entries", "every", "fill", "filter", "find", "findIndex", "flat", "flatMap", "forEach", "includes", "indexOf", "join", "keys", "lastIndexOf", "map", "pop", "push", "reduce", "reduceRight", "reverse", "shift", "slice", "some", "sort", "splice", "unshift", "values"]; // Set to undefined rather than delete, so it doesn't go up the chain to Array. Not perfect, but good enough? | ||
const arrayMethodsToDelete = [ | ||
"at", | ||
"concat", | ||
"copyWithin", | ||
"entries", | ||
"every", | ||
"fill", | ||
"filter", | ||
"find", | ||
"findIndex", | ||
"flat", | ||
"flatMap", | ||
"forEach", | ||
"includes", | ||
"indexOf", | ||
"join", | ||
"keys", | ||
"lastIndexOf", | ||
"map", | ||
"pop", | ||
"push", | ||
"reduce", | ||
"reduceRight", | ||
"reverse", | ||
"shift", | ||
"slice", | ||
"some", | ||
"sort", | ||
"splice", | ||
"unshift", | ||
"values", | ||
]; | ||
// Set to undefined rather than delete, so it doesn't go up the chain to Array. Not perfect, but good enough? | ||
for (const property of arrayPropertiesToDelete) { | ||
FakeDOMStringList[property] = undefined; | ||
(FakeDOMStringList as any)[property] = undefined; | ||
} | ||
for (const property of arrayMethodsToDelete) { | ||
FakeDOMStringList.prototype[property] = undefined; | ||
(FakeDOMStringList as any).prototype[property] = undefined; | ||
} | ||
*/ | ||
var _default = FakeDOMStringList; | ||
exports.default = _default; | ||
module.exports = exports.default; |
@@ -1,2 +0,1 @@ | ||
// Subclass Array to get nice behaviors like destructuring, but delete various Array methods that don't exist on DOMStringList https://github.com/dumbmatter/fakeIndexedDB/issues/66#issuecomment-922407403 | ||
class FakeDOMStringList extends Array { | ||
@@ -30,16 +29,50 @@ contains(value) { | ||
} // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array | ||
} // Would be nice to remove these properties to fix https://github.com/dumbmatter/fakeIndexedDB/issues/66 but for some reason it breaks Dexie - see test/dexie.js and FakeDOMStringList tests | ||
/* | ||
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array | ||
const arrayPropertiesToDelete = ["from", "isArray", "of"]; | ||
const arrayMethodsToDelete = ["at", "concat", "copyWithin", "entries", "every", "fill", "filter", "find", "findIndex", "flat", "flatMap", "forEach", "includes", "indexOf", "join", "keys", "lastIndexOf", "map", "pop", "push", "reduce", "reduceRight", "reverse", "shift", "slice", "some", "sort", "splice", "unshift", "values"]; // Set to undefined rather than delete, so it doesn't go up the chain to Array. Not perfect, but good enough? | ||
const arrayMethodsToDelete = [ | ||
"at", | ||
"concat", | ||
"copyWithin", | ||
"entries", | ||
"every", | ||
"fill", | ||
"filter", | ||
"find", | ||
"findIndex", | ||
"flat", | ||
"flatMap", | ||
"forEach", | ||
"includes", | ||
"indexOf", | ||
"join", | ||
"keys", | ||
"lastIndexOf", | ||
"map", | ||
"pop", | ||
"push", | ||
"reduce", | ||
"reduceRight", | ||
"reverse", | ||
"shift", | ||
"slice", | ||
"some", | ||
"sort", | ||
"splice", | ||
"unshift", | ||
"values", | ||
]; | ||
// Set to undefined rather than delete, so it doesn't go up the chain to Array. Not perfect, but good enough? | ||
for (const property of arrayPropertiesToDelete) { | ||
FakeDOMStringList[property] = undefined; | ||
(FakeDOMStringList as any)[property] = undefined; | ||
} | ||
for (const property of arrayMethodsToDelete) { | ||
FakeDOMStringList.prototype[property] = undefined; | ||
(FakeDOMStringList as any).prototype[property] = undefined; | ||
} | ||
*/ | ||
export default FakeDOMStringList; |
{ | ||
"name": "fake-indexeddb", | ||
"version": "4.0.0-beta.5", | ||
"version": "4.0.0-beta.6", | ||
"description": "Fake IndexedDB: a pure JS in-memory implementation of the IndexedDB API", | ||
@@ -98,3 +98,3 @@ "homepage": "https://github.com/dumbmatter/fakeIndexedDB", | ||
"test-w3c": "node src/test/web-platform-tests/run-all.js", | ||
"test": "rm -rf build && yarn run lint && yarn run build && yarn run test-jest && node test/test.js && yarn run test-w3c && yarn run test-mocha && yarn run test-qunit", | ||
"test": "rm -rf build && yarn run lint && yarn run build && yarn run test-jest && node test/test.js && node test/dexie.js && yarn run test-w3c && yarn run test-mocha && yarn run test-qunit", | ||
"prepare": "husky install" | ||
@@ -126,2 +126,3 @@ }, | ||
"core-js": "^3.23.3", | ||
"dexie": "^3.2.2", | ||
"glob": "^8.0.3", | ||
@@ -128,0 +129,0 @@ "husky": "^7.0.4", |
260138
6068
23