indexeddbshim 16.0.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/badges/licenses-badge-dev.svg +1 -1
- package/badges/licenses-badge.svg +1 -1
- package/dist/CFG.d.ts.map +1 -1
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/DOMStringList.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +5 -2
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBDatabase.d.ts +2 -1
- package/dist/IDBDatabase.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts +2 -1
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts +2 -1
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts +1 -1
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBObjectStore.d.ts +2 -1
- package/dist/IDBObjectStore.d.ts.map +1 -1
- package/dist/IDBRequest.d.ts +5 -3
- package/dist/IDBRequest.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +2 -1
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/Key.d.ts.map +1 -1
- package/dist/Sca.d.ts.map +1 -1
- package/dist/UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/browser-noninvasive.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +32 -27
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +2 -2
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +984 -1092
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +1220 -1233
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +8 -3
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +984 -1092
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +1219 -1232
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +8 -3
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +1219 -1232
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +8 -3
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts +2 -2
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/setGlobalVars.d.ts.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/package.json +112 -105
- package/src/CFG.js +2 -3
- package/src/DOMException.js +11 -9
- package/src/DOMStringList.js +8 -3
- package/src/Event.js +2 -0
- package/src/IDBCursor.js +22 -11
- package/src/IDBDatabase.js +9 -6
- package/src/IDBFactory.js +21 -15
- package/src/IDBIndex.js +82 -77
- package/src/IDBKeyRange.js +42 -35
- package/src/IDBObjectStore.js +83 -77
- package/src/IDBRequest.js +28 -15
- package/src/IDBTransaction.js +8 -4
- package/src/IDBVersionChangeEvent.js +2 -0
- package/src/Key.js +22 -12
- package/src/Sca.js +2 -1
- package/src/UnicodeIdentifiers.js +2 -2
- package/src/browser-UnicodeIdentifiers.js +1 -2
- package/src/browser-noninvasive.js +0 -1
- package/src/browser.js +0 -1
- package/src/node-UnicodeIdentifiers.js +1 -1
- package/src/node.js +1 -1
- package/src/setGlobalVars.js +13 -15
- package/src/unicode-regex.js +1 -1
- package/src/util.js +13 -12
package/src/browser.js
CHANGED
|
@@ -10,7 +10,7 @@ CFG.win = {openDatabase: nodeWebSQL};
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {import('./setGlobalVars.js').ShimmedObject} idb
|
|
12
12
|
* @param {import('./CFG.js').default} initialConfig
|
|
13
|
-
* @returns {
|
|
13
|
+
* @returns {import('./setGlobalVars.js').ShimmedObject|Window}
|
|
14
14
|
*/
|
|
15
15
|
const __setGlobalVars = function (idb, initialConfig = {}) {
|
|
16
16
|
const obj = setGlobalVars(idb, {fs, ...initialConfig});
|
package/src/node.js
CHANGED
|
@@ -9,7 +9,7 @@ CFG.win = {openDatabase: nodeWebSQL};
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {import('./setGlobalVars.js').ShimmedObject} idb
|
|
11
11
|
* @param {import('./CFG.js').default} initialConfig
|
|
12
|
-
* @returns {
|
|
12
|
+
* @returns {import('./setGlobalVars.js').ShimmedObject|Window}
|
|
13
13
|
*/
|
|
14
14
|
const __setGlobalVars = function (idb, initialConfig = {}) {
|
|
15
15
|
return setGlobalVars(idb, {fs, ...initialConfig});
|
package/src/setGlobalVars.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable unicorn/prefer-global-this -- Older browsers? */
|
|
2
1
|
import {setPrototypeOfCustomEvent} from 'eventtargeter';
|
|
3
2
|
import shimIDBVersionChangeEvent from './IDBVersionChangeEvent.js';
|
|
4
3
|
import {IDBCursor as shimIDBCursor, IDBCursorWithValue as shimIDBCursorWithValue} from './IDBCursor.js';
|
|
@@ -41,7 +40,7 @@ function setConfig (prop, val) {
|
|
|
41
40
|
});
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
|
-
if (!(prop
|
|
43
|
+
if (!Object.hasOwn(CFG, prop)) {
|
|
45
44
|
throw new Error(prop + ' is not a valid configuration property');
|
|
46
45
|
}
|
|
47
46
|
// @ts-expect-error Should not be `never` here!
|
|
@@ -265,7 +264,7 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
265
264
|
setFS(CFG.fs);
|
|
266
265
|
}
|
|
267
266
|
if (CFG.fullIDLSupport) {
|
|
268
|
-
// Slow per MDN so off by default! Though apparently needed for WebIDL:
|
|
267
|
+
// Slow per MDN so off by default! Though apparently needed for WebIDL: https://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements
|
|
269
268
|
|
|
270
269
|
Object.setPrototypeOf(IDB.IDBOpenDBRequest, IDB.IDBRequest);
|
|
271
270
|
Object.setPrototypeOf(IDB.IDBCursorWithValue, IDB.IDBCursor);
|
|
@@ -304,7 +303,7 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
304
303
|
|
|
305
304
|
/** @type {GetConfig} */
|
|
306
305
|
IDB.shimIndexedDB.__getConfig = function (prop) {
|
|
307
|
-
if (!(prop
|
|
306
|
+
if (!Object.hasOwn(CFG, prop)) {
|
|
308
307
|
throw new Error(prop + ' is not a valid configuration property');
|
|
309
308
|
}
|
|
310
309
|
return CFG[prop];
|
|
@@ -333,16 +332,16 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
333
332
|
|
|
334
333
|
// Workaround to prevent an error in Firefox
|
|
335
334
|
if (!('indexedDB' in IDB) && typeof window !== 'undefined') { // 2nd condition avoids problems in Node
|
|
336
|
-
IDB.indexedDB
|
|
335
|
+
IDB.indexedDB ||= /** @type {IDBFactory} */ (
|
|
337
336
|
('webkitIndexedDB' in IDB && IDB.webkitIndexedDB) ||
|
|
338
337
|
('mozIndexedDB' in IDB && IDB.mozIndexedDB) ||
|
|
339
338
|
('oIndexedDB' in IDB && IDB.oIndexedDB) ||
|
|
340
|
-
('msIndexedDB' in IDB && IDB.msIndexedDB)
|
|
339
|
+
('msIndexedDB' in IDB && IDB.msIndexedDB)
|
|
340
|
+
);
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
// Detect browsers with known IndexedDB issues (e.g. Android pre-4.4)
|
|
344
|
-
|
|
345
|
-
if (
|
|
344
|
+
const poorIndexedDbSupport = (
|
|
346
345
|
typeof navigator !== 'undefined' &&
|
|
347
346
|
// Not apparently defined in React Native
|
|
348
347
|
navigator.userAgent &&
|
|
@@ -354,18 +353,15 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
354
353
|
) ||
|
|
355
354
|
(
|
|
356
355
|
// Bad non-Safari iOS9 support (see <https://github.com/axemclion/IndexedDBShim/issues/252>)
|
|
357
|
-
(!navigator.userAgent.includes('Safari') || navigator.userAgent.includes('Chrome')) && // Exclude genuine Safari:
|
|
358
|
-
// Detect iOS:
|
|
359
|
-
// and detect version 9:
|
|
356
|
+
(!navigator.userAgent.includes('Safari') || navigator.userAgent.includes('Chrome')) && // Exclude genuine Safari: https://stackoverflow.com/a/7768006/271577
|
|
357
|
+
// Detect iOS: https://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
|
|
358
|
+
// and detect version 9: https://stackoverflow.com/a/26363560/271577
|
|
360
359
|
(/(iPad|iPhone|iPod).* os 9_/ui).test(navigator.userAgent) &&
|
|
361
360
|
(typeof window !== 'undefined' &&
|
|
362
|
-
// eslint-disable-next-line no-undef -- Extra check
|
|
363
361
|
!('MSStream' in window)) // But avoid IE11
|
|
364
362
|
)
|
|
365
363
|
)
|
|
366
|
-
)
|
|
367
|
-
poorIndexedDbSupport = true;
|
|
368
|
-
}
|
|
364
|
+
);
|
|
369
365
|
if (!CFG.DEFAULT_DB_SIZE) {
|
|
370
366
|
CFG.DEFAULT_DB_SIZE = (
|
|
371
367
|
( // Safari currently requires larger size: (We don't need a larger size for Node as node-websql doesn't use this info)
|
|
@@ -387,6 +383,7 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
387
383
|
) {
|
|
388
384
|
IDB.shimIndexedDB.__useShim();
|
|
389
385
|
} else {
|
|
386
|
+
/* eslint-disable unicorn/logical-assignment-operators -- TS */
|
|
390
387
|
IDB.IDBDatabase = IDB.IDBDatabase ||
|
|
391
388
|
('webkitIDBDatabase' in IDB && IDB.webkitIDBDatabase);
|
|
392
389
|
IDB.IDBTransaction = IDB.IDBTransaction ||
|
|
@@ -395,6 +392,7 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
395
392
|
('webkitIDBCursor' in IDB && IDB.webkitIDBCursor);
|
|
396
393
|
IDB.IDBKeyRange = IDB.IDBKeyRange ||
|
|
397
394
|
('webkitIDBKeyRange' in IDB && IDB.webkitIDBKeyRange);
|
|
395
|
+
/* eslint-enable unicorn/logical-assignment-operators -- TS */
|
|
398
396
|
}
|
|
399
397
|
return /** @type {ShimmedObject} */ (IDB);
|
|
400
398
|
}
|
package/src/unicode-regex.js
CHANGED
|
@@ -10,7 +10,7 @@ var hasRequiredRegex;
|
|
|
10
10
|
function requireRegex () {
|
|
11
11
|
if (hasRequiredRegex) return regex$1;
|
|
12
12
|
hasRequiredRegex = 1;
|
|
13
|
-
regex$1=/[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD806\uDD38|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
|
|
13
|
+
regex$1=/[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD801[\uDDC9\uDDE4]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C\uDF83\uDF85\uDF8E\uDF91\uDFC5\uDFC7\uDFC8]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD806\uDD38|\uD818[\uDD21-\uDD28]|\uD81B[\uDD68-\uDD6A]|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
|
|
14
14
|
return regex$1;
|
|
15
15
|
}
|
|
16
16
|
|
package/src/util.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable new-cap -- ToString is how it is defined */
|
|
2
|
-
/* eslint-disable sonarjs/no-control-regex -- Needed */
|
|
3
2
|
import CFG from './CFG.js';
|
|
4
3
|
import expandsOnNFD from './unicode-regex.js';
|
|
5
4
|
|
|
@@ -12,11 +11,11 @@ import expandsOnNFD from './unicode-regex.js';
|
|
|
12
11
|
* @returns {string}
|
|
13
12
|
*/
|
|
14
13
|
function escapeUnmatchedSurrogates (arg) {
|
|
15
|
-
//
|
|
14
|
+
// https://stackoverflow.com/a/6701665/271577
|
|
16
15
|
return arg.replaceAll(
|
|
17
16
|
/([\uD800-\uDBFF])(?![\uDC00-\uDFFF])|(^|[^\uD800-\uDBFF])([\uDC00-\uDFFF])/gu,
|
|
18
17
|
function (_, unmatchedHighSurrogate, precedingLow, unmatchedLowSurrogate) {
|
|
19
|
-
// Could add a corresponding surrogate for compatibility with `node-sqlite3`:
|
|
18
|
+
// Could add a corresponding surrogate for compatibility with `node-sqlite3`: https://bugs.python.org/issue12569 and https://stackoverflow.com/a/6701665/271577
|
|
20
19
|
// but Chrome having problems
|
|
21
20
|
if (unmatchedHighSurrogate) {
|
|
22
21
|
return '^2' + unmatchedHighSurrogate.codePointAt()
|
|
@@ -33,14 +32,14 @@ function escapeUnmatchedSurrogates (arg) {
|
|
|
33
32
|
* @returns {string}
|
|
34
33
|
*/
|
|
35
34
|
function escapeNameForSQLiteIdentifier (arg) {
|
|
36
|
-
//
|
|
35
|
+
// https://stackoverflow.com/a/6701665/271577
|
|
37
36
|
return '_' + // Prevent empty string
|
|
38
37
|
escapeUnmatchedSurrogates(
|
|
39
38
|
arg.replaceAll('^', '^^') // Escape our escape
|
|
40
|
-
//
|
|
39
|
+
// https://www.sqlite.org/src/tktview?name=57c971fc74
|
|
41
40
|
.replaceAll('\0', '^0')
|
|
42
41
|
// We need to avoid identifiers being treated as duplicates based on SQLite's ASCII-only case-insensitive table and column names
|
|
43
|
-
// (For SQL in general, however, see
|
|
42
|
+
// (For SQL in general, however, see https://stackoverflow.com/a/17215009/271577
|
|
44
43
|
// See also https://www.sqlite.org/faq.html#q18 re: Unicode (non-ASCII) case-insensitive not working
|
|
45
44
|
.replaceAll(/([A-Z])/gu, '^$1')
|
|
46
45
|
);
|
|
@@ -75,7 +74,7 @@ function unescapeSQLiteResponse (arg) {
|
|
|
75
74
|
*/
|
|
76
75
|
function sqlEscape (arg) {
|
|
77
76
|
// https://www.sqlite.org/lang_keywords.html
|
|
78
|
-
//
|
|
77
|
+
// https://stackoverflow.com/a/6701665/271577
|
|
79
78
|
// There is no need to escape ', `, or [], as
|
|
80
79
|
// we should always be within double quotes
|
|
81
80
|
// NUL should have already been stripped
|
|
@@ -114,7 +113,7 @@ function escapeDatabaseNameForSQLAndFiles (db) {
|
|
|
114
113
|
db = db.replace(
|
|
115
114
|
(CFG.databaseCharacterEscapeList
|
|
116
115
|
? new RegExp(CFG.databaseCharacterEscapeList, 'gu')
|
|
117
|
-
: /[\
|
|
116
|
+
: /[\u{0000}-\u{001F}\u{007F}"*/:<>?\\|]/gu), // eslint-disable-line no-control-regex -- Controls needed
|
|
118
117
|
function (n0) {
|
|
119
118
|
// eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
|
|
120
119
|
return '^1' + n0.charCodeAt(0).toString(16).padStart(2, '0');
|
|
@@ -302,7 +301,9 @@ function isBinary (obj) {
|
|
|
302
301
|
* @returns {boolean}
|
|
303
302
|
*/
|
|
304
303
|
function isIterable (obj) {
|
|
305
|
-
return isObj(obj) &&
|
|
304
|
+
return isObj(obj) &&
|
|
305
|
+
// eslint-disable-next-line unicorn/no-computed-property-existence-check -- May not be "own"
|
|
306
|
+
Symbol.iterator in obj &&
|
|
306
307
|
typeof obj[Symbol.iterator] === 'function';
|
|
307
308
|
}
|
|
308
309
|
|
|
@@ -398,7 +399,7 @@ function defineReadonlyProperties (obj, props, getter = null) {
|
|
|
398
399
|
props = typeof props === 'string' ? [props] : props;
|
|
399
400
|
props.forEach(function (prop) {
|
|
400
401
|
let o;
|
|
401
|
-
if (getter && prop
|
|
402
|
+
if (getter && Object.hasOwn(getter, prop)) {
|
|
402
403
|
o = getter[prop];
|
|
403
404
|
} else {
|
|
404
405
|
Object.defineProperty(obj, '__' + prop, {
|
|
@@ -438,7 +439,7 @@ function isIdentifier (item) {
|
|
|
438
439
|
// ID_Continue (includes Other_ID_Continue)
|
|
439
440
|
const UnicodeIDContinue = CFG.UnicodeIDContinue || '[$0-9A-Z_a-z]';
|
|
440
441
|
const IdentifierStart = '(?:' + UnicodeIDStart + '|[$_])';
|
|
441
|
-
const IdentifierPart = '(?:' + UnicodeIDContinue + '|[$_\
|
|
442
|
+
const IdentifierPart = '(?:' + UnicodeIDContinue + '|[$_\u{200C}\u{200D}])';
|
|
442
443
|
return (new RegExp('^' + IdentifierStart + IdentifierPart + '*$', 'u')).test(item);
|
|
443
444
|
}
|
|
444
445
|
|
|
@@ -462,7 +463,7 @@ function isValidKeyPathString (keyPathString) {
|
|
|
462
463
|
function isValidKeyPath (keyPath) {
|
|
463
464
|
return isValidKeyPathString(keyPath) || (
|
|
464
465
|
Array.isArray(keyPath) && Boolean(keyPath.length) &&
|
|
465
|
-
// Convert array from sparse to dense
|
|
466
|
+
// Convert array from sparse to dense https://www.2ality.com/2012/06/dense-arrays.html
|
|
466
467
|
// See also https://heycam.github.io/webidl/#idl-DOMString
|
|
467
468
|
[...keyPath].every((pathComponent) => {
|
|
468
469
|
return isValidKeyPathString(pathComponent);
|