indexeddbshim 6.6.0 → 9.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.
Files changed (35) hide show
  1. package/README.md +1 -6
  2. package/badges/coverage-badge.svg +1 -1
  3. package/badges/licenses-badge-dev.svg +1 -1
  4. package/badges/tests-badge.svg +1 -1
  5. package/dist/indexeddbshim-Key.js +34 -47
  6. package/dist/indexeddbshim-Key.js.map +1 -1
  7. package/dist/indexeddbshim-Key.min.js +2 -2
  8. package/dist/indexeddbshim-Key.min.js.map +1 -1
  9. package/dist/indexeddbshim-UnicodeIdentifiers-node.js +700 -570
  10. package/dist/indexeddbshim-UnicodeIdentifiers-node.js.map +1 -1
  11. package/dist/indexeddbshim-UnicodeIdentifiers.js +735 -631
  12. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  13. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +6 -6
  14. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  15. package/dist/indexeddbshim-node.js +700 -570
  16. package/dist/indexeddbshim-node.js.map +1 -1
  17. package/dist/indexeddbshim-noninvasive.js +736 -632
  18. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  19. package/dist/indexeddbshim-noninvasive.min.js +6 -6
  20. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  21. package/dist/indexeddbshim.js +735 -631
  22. package/dist/indexeddbshim.js.map +1 -1
  23. package/dist/indexeddbshim.min.js +6 -6
  24. package/dist/indexeddbshim.min.js.map +1 -1
  25. package/examples/IDBKeyUtils.html +0 -1
  26. package/index.html +5 -4
  27. package/package.json +58 -65
  28. package/src/DOMStringList.js +3 -3
  29. package/src/IDBDatabase.js +1 -1
  30. package/src/IDBObjectStore.js +3 -2
  31. package/src/IDBRequest.js +2 -2
  32. package/src/Key.js +9 -8
  33. package/src/unicode-regex.js +2 -2
  34. package/src/util.js +13 -18
  35. package/CHANGES.md +0 -1173
@@ -7,7 +7,6 @@
7
7
  </head>
8
8
  <body>
9
9
  <script src="../node_modules/core-js-bundle/minified.js"></script>
10
- <script src="../node_modules/regenerator-runtime/runtime.js"></script>
11
10
  <script src="../dist/indexeddbshim-Key.min.js"></script>
12
11
  <script>
13
12
  // import {extractKeyValueDecodedFromValueUsingKeyPath} from './src/Key.js';
package/index.html CHANGED
@@ -101,10 +101,11 @@
101
101
  var _gaq; // eslint-disable-line no-var
102
102
  if (!window.location.href.includes('noanalytics=true')) { // Slowing testing down in China where Google is blocked so giving an out
103
103
  _gaq = _gaq || [];
104
- _gaq.push(['_setAccount', 'UA-617499-9']);
105
- _gaq.push(['_setDomainName', 'none']);
106
- _gaq.push(['_setAllowLinker', true]);
107
- _gaq.push(['_trackPageview']);
104
+ _gaq.push(
105
+ ['_setAccount', 'UA-617499-9'],
106
+ ['_setDomainName', 'none'],
107
+ ['_setAllowLinker', true]
108
+ );
108
109
 
109
110
  (function () {
110
111
  const ga = document.createElement('script');
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "6.6.0",
3
+ "version": "9.0.0",
4
4
  "author": "Parashuram <code@nparashuram.com>",
5
5
  "contributors": [
6
6
  "Brett Zamir"
7
7
  ],
8
+ "license": "(MIT OR Apache-2.0)",
8
9
  "homepage": "https://github.com/indexeddbshim/IndexedDBShim",
9
10
  "description": "A polyfill for IndexedDB using WebSql",
10
11
  "nyc": {
@@ -24,7 +25,7 @@
24
25
  ]
25
26
  },
26
27
  "scripts": {
27
- "prepublishOnly": "npm run license-badges",
28
+ "prepublishOnly": "echo 'reenable when license-badger updated: npm run license-badges'",
28
29
  "license-badge": "license-badger --corrections --uncategorizedLicenseTemplate \"\\${license} (\\${name} (\\${version}))\" --filteredTypes=nonempty --textTemplate \"License types\n(project, deps, and bundled devDeps)\" --packageJson --production badges/licenses-badge.svg",
29
30
  "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
30
31
  "license-badges": "run-p license-badge license-badge-dev",
@@ -39,8 +40,7 @@
39
40
  "clean-mock": "rimraf D_test_database*",
40
41
  "clean-w3c": "rimraf D_^D^B2* D_db* D_test* D_about* D_^I^D^B* D_blank* D_database_name* D_idbtransaction* D_x D_x.sqlite D_y D_y.sqlite D_webworker* D_http*",
41
42
  "clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
42
- "copy": "copyup node_modules/regenerator-runtime/runtime.js node_modules/core-js-bundle/minified.js node_modules/source-map-support/browser-source-map-support.js node_modules/mocha/mocha.css node_modules/mocha/mocha.js node_modules/chai/chai.js node_modules/sinon/pkg/sinon-no-sourcemaps.js test-support",
43
- "remark": "remark -q -f .",
43
+ "copy": "copyup node_modules/core-js-bundle/minified.js node_modules/source-map-support/browser-source-map-support.js node_modules/mocha/mocha.css node_modules/mocha/mocha.js node_modules/chai/chai.js node_modules/sinon/pkg/sinon-no-sourcemaps.js test-support",
44
44
  "lint": "eslint --ext=js,md,html .",
45
45
  "eslint": "npm run lint",
46
46
  "sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
@@ -128,86 +128,79 @@
128
128
  "last 3 and_uc versions",
129
129
  "last 3 Samsung versions"
130
130
  ],
131
+ "engines": {
132
+ "node": ">=12.0.0"
133
+ },
131
134
  "dependencies": {
132
135
  "eventtargeter": "0.8.0",
133
- "regenerator-runtime": "^0.13.5",
134
136
  "sync-promise": "git+https://github.com/brettz9/sync-promise.git#full-sync-missing-promise-features",
135
- "typeson": "5.18.2",
136
- "typeson-registry": "1.0.0-alpha.37",
137
- "websql": "git+https://github.com/brettz9/node-websql.git#configurable-secure2"
137
+ "typeson": "6.1.0",
138
+ "typeson-registry": "1.0.0-alpha.39",
139
+ "websql": "git+https://github.com/brettz9/node-websql.git#configurable-secure3"
138
140
  },
139
141
  "devDependencies": {
140
- "@babel/core": "^7.10.3",
141
- "@babel/preset-env": "^7.10.3",
142
- "@mochajs/json-file-reporter": "^1.2.1",
143
- "@mysticatea/eslint-plugin": "^13.0.0",
144
- "@rollup/plugin-babel": "^5.0.4",
145
- "@rollup/plugin-commonjs": "^13.0.0",
142
+ "@babel/core": "^7.16.7",
143
+ "@babel/preset-env": "^7.16.7",
144
+ "@brettz9/eslint-plugin": "^1.0.4",
145
+ "@brettz9/node-static": "^0.1.1",
146
+ "@mochajs/json-file-reporter": "^1.3.0",
147
+ "@rollup/plugin-babel": "^5.3.0",
148
+ "@rollup/plugin-commonjs": "^21.0.1",
146
149
  "@rollup/plugin-json": "^4.1.0",
147
- "@rollup/plugin-node-resolve": "^8.1.0",
148
- "@rollup/plugin-replace": "^2.3.3",
149
- "babel-plugin-add-module-exports": "1.0.2",
150
- "bson": "^4.0.4",
151
- "builtin-modules": "^3.1.0",
152
- "canvas": "^2.6.1",
153
- "chai": "4.2.0",
154
- "chokidar-cli": "^2.1.0",
150
+ "@rollup/plugin-node-resolve": "^13.1.2",
151
+ "@rollup/plugin-replace": "^3.0.1",
152
+ "@unicode/unicode-13.0.0": "1.2.1",
153
+ "babel-plugin-add-module-exports": "1.0.4",
154
+ "bson": "^4.6.0",
155
+ "builtin-modules": "^3.2.0",
156
+ "canvas": "^2.8.0",
157
+ "chai": "4.3.4",
158
+ "chokidar-cli": "^3.0.0",
155
159
  "colors": "1.4.0",
156
- "copyfiles": "^2.3.0",
157
- "core-js-bundle": "^3.6.5",
158
- "coveradge": "^0.6.0",
160
+ "copyfiles": "^2.4.1",
161
+ "core-js-bundle": "^3.20.2",
162
+ "coveradge": "^0.7.0",
159
163
  "cyclonejs": "1.1.4",
160
- "cypress-multi-reporters": "^1.4.0",
161
164
  "delay-cli": "^1.1.0",
162
- "eslint": "^7.3.1",
163
- "eslint-config-ash-nazg": "^22.5.1",
164
- "eslint-config-standard": "^14.1.1",
165
- "eslint-plugin-array-func": "^3.1.6",
166
- "eslint-plugin-compat": "^3.7.0",
165
+ "eslint": "^8.6.0",
166
+ "eslint-config-ash-nazg": "^32.3.0",
167
+ "eslint-config-standard": "^16.0.3",
168
+ "eslint-plugin-array-func": "^3.1.7",
169
+ "eslint-plugin-compat": "^4.0.0",
167
170
  "eslint-plugin-eslint-comments": "^3.2.0",
168
- "eslint-plugin-html": "^6.0.2",
169
- "eslint-plugin-import": "^2.21.2",
170
- "eslint-plugin-jsdoc": "^28.5.1",
171
- "eslint-plugin-markdown": "^1.0.2",
172
- "eslint-plugin-no-unsanitized": "^3.1.2",
171
+ "eslint-plugin-html": "^6.2.0",
172
+ "eslint-plugin-import": "^2.25.4",
173
+ "eslint-plugin-jsdoc": "^37.5.1",
174
+ "eslint-plugin-markdown": "^2.2.1",
175
+ "eslint-plugin-no-unsanitized": "^4.0.1",
173
176
  "eslint-plugin-no-use-extend-native": "^0.5.0",
174
177
  "eslint-plugin-node": "^11.1.0",
175
- "eslint-plugin-promise": "^4.2.1",
176
- "eslint-plugin-sonarjs": "^0.5.0",
177
- "eslint-plugin-standard": "^4.0.1",
178
- "eslint-plugin-unicorn": "^20.1.0",
179
- "is-date-object": "1.0.2",
180
- "isomorphic-fetch": "^2.2.1",
181
- "jsdom": "^16.2.2",
182
- "license-badger": "^0.17.0",
178
+ "eslint-plugin-promise": "^6.0.0",
179
+ "eslint-plugin-sonarjs": "^0.11.0",
180
+ "eslint-plugin-standard": "^4.1.0",
181
+ "eslint-plugin-unicorn": "^40.0.0",
182
+ "got": "^11.8.3",
183
+ "is-date-object": "1.0.5",
184
+ "isomorphic-fetch": "^3.0.0",
185
+ "jsdom": "^19.0.0",
186
+ "license-badger": "^0.19.0",
183
187
  "local-xmlhttprequest": "2.0.0",
184
- "mocha": "^8.0.1",
185
- "mocha-badge-generator": "^0.8.0",
186
- "node-static": "^0.7.11",
188
+ "mocha": "^9.1.3",
189
+ "mocha-badge-generator": "^0.9.0",
190
+ "mocha-multi-reporters": "^1.5.1",
187
191
  "npm-run-all": "^4.1.5",
188
192
  "nyc": "^15.1.0",
189
- "open-cli": "^6.0.1",
190
- "remark-cli": "^8.0.0",
191
- "remark-lint-ordered-list-marker-value": "^2.0.0",
192
- "request": "^2.88",
193
- "request-promise-native": "^1.0.8",
193
+ "open-cli": "^7.0.1",
194
194
  "rimraf": "^3.0.2",
195
- "rollup": "^2.18.0",
196
- "rollup-plugin-filesize": "^9.0.1",
195
+ "rollup": "^2.63.0",
196
+ "rollup-plugin-filesize": "^9.1.1",
197
197
  "rollup-plugin-node-globals": "^1.4.0",
198
198
  "rollup-plugin-node-polyfills": "^0.2.1",
199
- "rollup-plugin-terser": "^6.1.0",
200
- "sinon": "^9.0.2",
201
- "source-map-support": "0.5.19",
199
+ "rollup-plugin-terser": "^7.0.2",
200
+ "sinon": "^12.0.1",
201
+ "source-map-support": "0.5.21",
202
202
  "sourcemap-transformer": "git+https://github.com/brettz9/sourcemap-transformer.git",
203
- "typescript": "^3.9.5",
204
- "unicode-10.0.0": "0.7.5",
205
203
  "w3c-blob": "0.0.1",
206
- "ws": "^7.3.0"
207
- },
208
- "bundleDependencies": [],
209
- "license": "(MIT OR Apache-2.0)",
210
- "engines": {
211
- "node": ">=6.9.2"
204
+ "ws": "^8.4.0"
212
205
  }
213
206
  }
@@ -61,11 +61,11 @@ DOMStringList.prototype = {
61
61
  return this._items;
62
62
  },
63
63
  forEach (cb, thisArg) {
64
- // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
64
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
65
65
  this._items.forEach(cb, thisArg);
66
66
  },
67
67
  map (cb, thisArg) {
68
- // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
68
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
69
69
  return this._items.map(cb, thisArg);
70
70
  },
71
71
  indexOf (str) {
@@ -101,7 +101,7 @@ DOMStringList.prototype = {
101
101
  };
102
102
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
103
103
  value (obj) {
104
- return ({}.toString.call(obj) === 'DOMStringListPrototype');
104
+ return Object.prototype.toString.call(obj) === 'DOMStringListPrototype';
105
105
  }
106
106
  });
107
107
  const DOMStringListAlias = DOMStringList;
@@ -104,7 +104,7 @@ IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions
104
104
  throw createDOMException('InvalidAccessError', 'With autoIncrement set, the keyPath argument must not be an array or empty string.');
105
105
  }
106
106
 
107
- /** @name IDBObjectStoreProperties **/
107
+ /** @name IDBObjectStoreProperties */
108
108
  const storeProperties = {
109
109
  name: storeName,
110
110
  keyPath,
@@ -481,7 +481,8 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
481
481
  return undefined;
482
482
  }).catch(function (err) {
483
483
  function fail () {
484
- // Todo: Add a different error object here if `assignCurrentNumber` fails in reverting?
484
+ // Todo: Add a different error object here if `assignCurrentNumber`
485
+ // fails in reverting?
485
486
  error(err);
486
487
  }
487
488
  if (typeof oldCn === 'number') {
@@ -828,7 +829,7 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optiona
828
829
  }
829
830
 
830
831
  optionalParameters = optionalParameters || {};
831
- /** @name IDBIndexProperties **/
832
+ /** @name IDBIndexProperties */
832
833
  const indexProperties = {
833
834
  columnName: indexName,
834
835
  keyPath,
package/src/IDBRequest.js CHANGED
@@ -20,7 +20,7 @@ IDBRequest.__super = function IDBRequest () {
20
20
  this.__setOptions({
21
21
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
22
22
  });
23
- doneFlagGetters.forEach(function (prop) {
23
+ doneFlagGetters.forEach((prop) => {
24
24
  Object.defineProperty(this, '__' + prop, {
25
25
  enumerable: false,
26
26
  configurable: false,
@@ -36,7 +36,7 @@ IDBRequest.__super = function IDBRequest () {
36
36
  return this['__' + prop];
37
37
  }
38
38
  });
39
- }, this);
39
+ });
40
40
  util.defineReadonlyProperties(this, readonlyProperties, {
41
41
  readyState: {
42
42
  get readyState () {
package/src/Key.js CHANGED
@@ -21,7 +21,7 @@ const keyTypeToEncodedChar = {
21
21
  };
22
22
  const keyTypes = Object.keys(keyTypeToEncodedChar);
23
23
  keyTypes.forEach((k) => {
24
- keyTypeToEncodedChar[k] = String.fromCharCode(keyTypeToEncodedChar[k]);
24
+ keyTypeToEncodedChar[k] = String.fromCodePoint(keyTypeToEncodedChar[k]);
25
25
  });
26
26
 
27
27
  const encodedCharToKeyType = keyTypes.reduce((o, k) => {
@@ -135,9 +135,9 @@ const types = {
135
135
 
136
136
  switch (signValues[sign]) {
137
137
  case 'negativeInfinity':
138
- return -Infinity;
138
+ return Number.NEGATIVE_INFINITY;
139
139
  case 'positiveInfinity':
140
- return Infinity;
140
+ return Number.POSITIVE_INFINITY;
141
141
  case 'bigPositive':
142
142
  return pow32(mantissa, exponent);
143
143
  case 'smallPositive':
@@ -221,7 +221,9 @@ const types = {
221
221
  // `ArrayBuffer`/Views on buffers (`TypedArray` or `DataView`)
222
222
  encode (key) {
223
223
  return keyTypeToEncodedChar.binary + '-' + (key.byteLength
224
- ? [...getCopyBytesHeldByBufferSource(key)].map((b) => util.padStart(b, 3, '0')) // e.g., '255,005,254,000,001,033'
224
+ ? [...getCopyBytesHeldByBufferSource(key)].map(
225
+ (b) => String(b).padStart(3, '0')
226
+ ) // e.g., '255,005,254,000,001,033'
225
227
  : '');
226
228
  },
227
229
  decode (key) {
@@ -300,11 +302,10 @@ function pow32 (mantissa, exponent) {
300
302
 
301
303
  /**
302
304
  * @param {Float} num
303
- * @param {Float} precision
305
+ * @param {Float} [precision=16]
304
306
  * @returns {Float}
305
307
  */
306
- function roundToPrecision (num, precision) {
307
- precision = precision || 16;
308
+ function roundToPrecision (num, precision = 16) {
308
309
  return Number.parseFloat(num.toPrecision(precision));
309
310
  }
310
311
 
@@ -937,7 +938,7 @@ function setCurrentNumber (tx, store, num, successCb, failCb) {
937
938
  function generateKeyForStore (tx, store, cb, sqlFailCb) {
938
939
  getCurrentNumber(tx, store, function (key) {
939
940
  if (key > MAX_ALLOWED_CURRENT_NUMBER) { // 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
940
- cb('failure'); // eslint-disable-line standard/no-callback-literal
941
+ cb('failure'); // eslint-disable-line node/no-callback-literal
941
942
  return;
942
943
  }
943
944
  // Increment current number by 1 (we cannot leverage SQLite's
@@ -1,3 +1,3 @@
1
- var regex=/[\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]|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
1
+ var regex=/[\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]/;
2
2
 
3
- export default regex;
3
+ export { regex as default };
package/src/util.js CHANGED
@@ -9,9 +9,11 @@ function escapeUnmatchedSurrogates (arg) {
9
9
  // Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
10
10
  // but Chrome having problems
11
11
  if (unmatchedHighSurrogate) {
12
- return '^2' + padStart(unmatchedHighSurrogate.charCodeAt().toString(16), 4, '0');
12
+ return '^2' + unmatchedHighSurrogate.codePointAt()
13
+ .toString(16).padStart(4, '0');
13
14
  }
14
- return (precedingLow || '') + '^3' + padStart(unmatchedLowSurrogate.charCodeAt().toString(16), 4, '0');
15
+ return (precedingLow || '') + '^3' +
16
+ unmatchedLowSurrogate.codePointAt().toString(16).padStart(4, '0');
15
17
  }
16
18
  );
17
19
  }
@@ -68,11 +70,8 @@ function escapeDatabaseNameForSQLAndFiles (db) {
68
70
  db = 'D' + escapeNameForSQLiteIdentifier(db);
69
71
  if (CFG.escapeNFDForDatabaseNames !== false) {
70
72
  // ES6 copying of regex with different flags
71
- // Todo: Remove `.source` when
72
- // https://github.com/babel/babel/issues/5978 completed (see also
73
- // https://github.com/axemclion/IndexedDBShim/issues/311#issuecomment-316090147 )
74
- db = db.replace(new RegExp(expandsOnNFD.source, 'gu'), function (expandable) {
75
- return '^4' + padStart(expandable.codePointAt().toString(16), 6, '0');
73
+ db = db.replace(new RegExp(expandsOnNFD, 'gu'), function (expandable) {
74
+ return '^4' + expandable.codePointAt().toString(16).padStart(6, '0');
76
75
  });
77
76
  }
78
77
  if (CFG.databaseCharacterEscapeList !== false) {
@@ -81,7 +80,8 @@ function escapeDatabaseNameForSQLAndFiles (db) {
81
80
  ? new RegExp(CFG.databaseCharacterEscapeList, 'gu')
82
81
  : /[\u0000-\u001F\u007F"*/:<>?\\|]/gu), // eslint-disable-line no-control-regex
83
82
  function (n0) {
84
- return '^1' + padStart(n0.charCodeAt().toString(16), 2, '0');
83
+ // eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
84
+ return '^1' + n0.charCodeAt().toString(16).padStart(2, '0');
85
85
  }
86
86
  );
87
87
  }
@@ -99,11 +99,11 @@ function unescapeUnmatchedSurrogates (arg) {
99
99
  return arg
100
100
  .replace(/(\^+)3(d[0-9a-f]{3})/gu, (_, esc, lowSurr) => {
101
101
  return esc.length % 2
102
- ? esc.slice(1) + String.fromCharCode(Number.parseInt(lowSurr, 16))
102
+ ? esc.slice(1) + String.fromCodePoint(Number.parseInt(lowSurr, 16))
103
103
  : _;
104
104
  }).replace(/(\^+)2(d[0-9a-f]{3})/gu, (_, esc, highSurr) => {
105
105
  return esc.length % 2
106
- ? esc.slice(1) + String.fromCharCode(Number.parseInt(highSurr, 16))
106
+ ? esc.slice(1) + String.fromCodePoint(Number.parseInt(highSurr, 16))
107
107
  : _;
108
108
  });
109
109
  }
@@ -123,7 +123,7 @@ function unescapeDatabaseNameForSQLAndFiles (db) {
123
123
  // CFG.databaseCharacterEscapeList
124
124
  .replace(/(\^+)1([0-9a-f]{2})/gu, (_, esc, hex) => {
125
125
  return esc.length % 2
126
- ? esc.slice(1) + String.fromCharCode(Number.parseInt(hex, 16))
126
+ ? esc.slice(1) + String.fromCodePoint(Number.parseInt(hex, 16))
127
127
  : _;
128
128
  // CFG.escapeNFDForDatabaseNames
129
129
  }).replace(/(\^+)4([0-9a-f]{6})/gu, (_, esc, hex) => {
@@ -353,12 +353,7 @@ function isNullish (v) {
353
353
  }
354
354
 
355
355
  function hasOwn (obj, prop) {
356
- return {}.hasOwnProperty.call(obj, prop);
357
- }
358
-
359
- // Todo: Replace with `String.prototype.padStart` when targeting supporting Node version
360
- function padStart (str, ct, fill) {
361
- return new Array(ct - (String(str)).length + 1).join(fill) + str;
356
+ return Object.prototype.hasOwnProperty.call(obj, prop);
362
357
  }
363
358
 
364
359
  export {escapeSQLiteStatement, unescapeSQLiteResponse,
@@ -371,4 +366,4 @@ export {escapeSQLiteStatement, unescapeSQLiteResponse,
371
366
  defineListenerProperties, defineReadonlyProperties,
372
367
  isValidKeyPath, enforceRange,
373
368
  convertToDOMString, convertToSequenceDOMString,
374
- isNullish, hasOwn, padStart};
369
+ isNullish, hasOwn};