lib0 0.2.39 → 0.2.43
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 +84 -76
- package/bin/gendocs.js +1 -1
- package/broadcastchannel.js +1 -1
- package/component.d.ts +4 -1
- package/component.d.ts.map +1 -1
- package/component.js +4 -1
- package/decoding.d.ts +0 -12
- package/decoding.d.ts.map +1 -1
- package/decoding.js +8 -8
- package/diff.d.ts.map +1 -1
- package/dist/{broadcastchannel-cb74c2ae.cjs → broadcastchannel-044f32d2.cjs} +3 -3
- package/dist/broadcastchannel-044f32d2.cjs.map +1 -0
- package/dist/broadcastchannel.cjs +4 -4
- package/dist/{buffer-097552c3.cjs → buffer-49880125.cjs} +16 -15
- package/dist/buffer-49880125.cjs.map +1 -0
- package/dist/buffer.cjs +3 -3
- package/dist/component.cjs +5 -2
- package/dist/component.cjs.map +1 -1
- package/dist/component.d.ts +4 -1
- package/dist/component.d.ts.map +1 -1
- package/dist/decoding.cjs +3 -3
- package/dist/decoding.d.ts +0 -12
- package/dist/decoding.d.ts.map +1 -1
- package/dist/diff.d.ts.map +1 -1
- package/dist/encoding.cjs +3 -3
- package/dist/encoding.d.ts.map +1 -1
- package/dist/{environment-bf1f625d.cjs → environment-7e2ffaea.cjs} +1 -1
- package/dist/{environment-bf1f625d.cjs.map → environment-7e2ffaea.cjs.map} +1 -1
- package/dist/environment.cjs +1 -1
- package/dist/{error-55a9a8c8.cjs → error-873c9cbf.cjs} +4 -4
- package/dist/error-873c9cbf.cjs.map +1 -0
- package/dist/error.cjs +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/{indexeddb-44227700.cjs → indexeddb-5b4b0e13.cjs} +27 -25
- package/dist/indexeddb-5b4b0e13.cjs.map +1 -0
- package/dist/indexeddb.cjs +3 -3
- package/dist/indexeddb.d.ts +2 -2
- package/dist/indexeddb.d.ts.map +1 -1
- package/dist/isomorphic.cjs +2 -6
- package/dist/isomorphic.cjs.map +1 -1
- package/dist/{logging-4941d274.cjs → logging-7cc36806.cjs} +2 -2
- package/dist/{logging-4941d274.cjs.map → logging-7cc36806.cjs.map} +1 -1
- package/dist/logging.cjs +2 -2
- package/dist/{number-24f1eabe.cjs → number-e62129bc.cjs} +5 -2
- package/dist/number-e62129bc.cjs.map +1 -0
- package/dist/number.cjs +2 -1
- package/dist/number.cjs.map +1 -1
- package/dist/number.d.ts +1 -0
- package/dist/number.d.ts.map +1 -1
- package/dist/observable.d.ts.map +1 -1
- package/dist/pair.d.ts.map +1 -1
- package/dist/{prng-70808343.cjs → prng-97174619.cjs} +2 -2
- package/dist/{prng-70808343.cjs.map → prng-97174619.cjs.map} +1 -1
- package/dist/prng.cjs +4 -4
- package/dist/{promise-f0a086b2.cjs → promise-1a9fe712.cjs} +10 -1
- package/dist/{promise-f0a086b2.cjs.map → promise-1a9fe712.cjs.map} +1 -1
- package/dist/promise.cjs +2 -1
- package/dist/promise.cjs.map +1 -1
- package/dist/promise.d.ts +1 -0
- package/dist/promise.d.ts.map +1 -1
- package/dist/storage.cjs +16 -4
- package/dist/storage.cjs.map +1 -1
- package/dist/storage.d.ts +5 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.test.d.ts +3 -0
- package/dist/storage.test.d.ts.map +1 -0
- package/dist/string.cjs +1 -3
- package/dist/string.cjs.map +1 -1
- package/dist/test.cjs +264 -225
- package/dist/test.cjs.map +1 -1
- package/dist/test.js +266 -227
- package/dist/test.js.map +1 -1
- package/dist/testing.cjs +15 -12
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.test.d.ts +1 -1
- package/dist/tree.d.ts +1 -1
- package/dist/tree.d.ts.map +1 -1
- package/dist/websocket.d.ts +1 -1
- package/dist/websocket.d.ts.map +1 -1
- package/encoding.d.ts.map +1 -1
- package/encoding.js +5 -4
- package/error.d.ts.map +1 -1
- package/error.js +3 -3
- package/indexeddb.d.ts +2 -2
- package/indexeddb.d.ts.map +1 -1
- package/indexeddb.js +25 -23
- package/number.d.ts +1 -0
- package/number.d.ts.map +1 -1
- package/number.js +1 -0
- package/observable.d.ts.map +1 -1
- package/package.json +11 -10
- package/pair.d.ts.map +1 -1
- package/promise.d.ts +1 -0
- package/promise.d.ts.map +1 -1
- package/promise.js +7 -0
- package/storage.d.ts +5 -0
- package/storage.d.ts.map +1 -1
- package/storage.js +15 -4
- package/storage.test.d.ts +3 -0
- package/storage.test.d.ts.map +1 -0
- package/test.js +3 -1
- package/testing.d.ts +1 -1
- package/testing.d.ts.map +1 -1
- package/testing.js +9 -6
- package/testing.test.d.ts +1 -1
- package/tree.d.ts +1 -1
- package/tree.d.ts.map +1 -1
- package/websocket.d.ts +1 -1
- package/websocket.d.ts.map +1 -1
- package/dist/broadcastchannel-cb74c2ae.cjs.map +0 -1
- package/dist/buffer-097552c3.cjs.map +0 -1
- package/dist/error-55a9a8c8.cjs.map +0 -1
- package/dist/indexeddb-44227700.cjs.map +0 -1
- package/dist/number-24f1eabe.cjs.map +0 -1
package/dist/test.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @function
|
|
17
17
|
*/
|
|
18
|
-
const create = () => new Map();
|
|
18
|
+
const create$7 = () => new Map();
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Copy a Map object into a fresh Map object.
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @return {Map<X,Y>}
|
|
27
27
|
*/
|
|
28
28
|
const copy = m => {
|
|
29
|
-
const r = create();
|
|
29
|
+
const r = create$7();
|
|
30
30
|
m.forEach((v, k) => { r.set(k, v); });
|
|
31
31
|
return r
|
|
32
32
|
};
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
* @param {function(V,K):R} f
|
|
66
66
|
* @return {Array<R>}
|
|
67
67
|
*/
|
|
68
|
-
const map = (m, f) => {
|
|
68
|
+
const map$3 = (m, f) => {
|
|
69
69
|
const res = [];
|
|
70
70
|
for (const [key, value] of m) {
|
|
71
71
|
res.push(f(value, key));
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
/* istanbul ignore next */
|
|
203
203
|
const undefinedToNull = v => v === undefined ? null : v;
|
|
204
204
|
|
|
205
|
-
/* global localStorage */
|
|
205
|
+
/* global localStorage, addEventListener */
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
208
|
* Isomorphic variable storage.
|
|
@@ -220,10 +220,10 @@
|
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* @param {string} key
|
|
223
|
-
* @param {any}
|
|
223
|
+
* @param {any} newValue
|
|
224
224
|
*/
|
|
225
|
-
setItem (key,
|
|
226
|
-
this.map.set(key,
|
|
225
|
+
setItem (key, newValue) {
|
|
226
|
+
this.map.set(key, newValue);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/**
|
|
@@ -239,12 +239,14 @@
|
|
|
239
239
|
* @type {any}
|
|
240
240
|
*/
|
|
241
241
|
let _localStorage = new VarStoragePolyfill();
|
|
242
|
+
let usePolyfill = true;
|
|
242
243
|
|
|
243
244
|
try {
|
|
244
245
|
// if the same-origin rule is violated, accessing localStorage might thrown an error
|
|
245
246
|
/* istanbul ignore next */
|
|
246
247
|
if (typeof localStorage !== 'undefined') {
|
|
247
248
|
_localStorage = localStorage;
|
|
249
|
+
usePolyfill = false;
|
|
248
250
|
}
|
|
249
251
|
} catch (e) { }
|
|
250
252
|
|
|
@@ -254,6 +256,15 @@
|
|
|
254
256
|
*/
|
|
255
257
|
const varStorage = _localStorage;
|
|
256
258
|
|
|
259
|
+
/* istanbul ignore next */
|
|
260
|
+
/**
|
|
261
|
+
* A polyfill for `addEventListener('storage', event => {..})` that does nothing if the polyfill is being used.
|
|
262
|
+
*
|
|
263
|
+
* @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler
|
|
264
|
+
* @function
|
|
265
|
+
*/
|
|
266
|
+
const onChange = eventHandler => usePolyfill || addEventListener('storage', /** @type {any} */ (eventHandler));
|
|
267
|
+
|
|
257
268
|
/**
|
|
258
269
|
* Isomorphic module to work access the environment (query params, env variables).
|
|
259
270
|
*
|
|
@@ -277,7 +288,7 @@
|
|
|
277
288
|
const computeParams = () => {
|
|
278
289
|
if (params === undefined) {
|
|
279
290
|
if (isNode) {
|
|
280
|
-
params = create();
|
|
291
|
+
params = create$7();
|
|
281
292
|
const pargs = process.argv;
|
|
282
293
|
let currParamName = null;
|
|
283
294
|
/* istanbul ignore next */
|
|
@@ -300,7 +311,7 @@
|
|
|
300
311
|
}
|
|
301
312
|
// in ReactNative for example this would not be true (unless connected to the Remote Debugger)
|
|
302
313
|
} else if (typeof location === 'object') {
|
|
303
|
-
params = create()
|
|
314
|
+
params = create$7()
|
|
304
315
|
// eslint-disable-next-line no-undef
|
|
305
316
|
;(location.search || '?').slice(1).split('&').forEach(kv => {
|
|
306
317
|
if (kv.length !== 0) {
|
|
@@ -310,7 +321,7 @@
|
|
|
310
321
|
}
|
|
311
322
|
});
|
|
312
323
|
} else {
|
|
313
|
-
params = create();
|
|
324
|
+
params = create$7();
|
|
314
325
|
}
|
|
315
326
|
}
|
|
316
327
|
return params
|
|
@@ -360,7 +371,7 @@
|
|
|
360
371
|
*
|
|
361
372
|
* @return {Symbol}
|
|
362
373
|
*/
|
|
363
|
-
const create$
|
|
374
|
+
const create$6 = Symbol;
|
|
364
375
|
|
|
365
376
|
/**
|
|
366
377
|
* Working with value pairs.
|
|
@@ -388,7 +399,7 @@
|
|
|
388
399
|
* @param {R} right
|
|
389
400
|
* @return {Pair<L,R>}
|
|
390
401
|
*/
|
|
391
|
-
const create$
|
|
402
|
+
const create$5 = (left, right) => new Pair(left, right);
|
|
392
403
|
|
|
393
404
|
/**
|
|
394
405
|
* @template L,R
|
|
@@ -403,7 +414,7 @@
|
|
|
403
414
|
* @param {Array<Pair<L,R>>} arr
|
|
404
415
|
* @param {function(L, R):any} f
|
|
405
416
|
*/
|
|
406
|
-
const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right));
|
|
417
|
+
const forEach$1 = (arr, f) => arr.forEach(p => f(p.left, p.right));
|
|
407
418
|
|
|
408
419
|
/**
|
|
409
420
|
* @template L,R,X
|
|
@@ -411,7 +422,7 @@
|
|
|
411
422
|
* @param {function(L, R):X} f
|
|
412
423
|
* @return {Array<X>}
|
|
413
424
|
*/
|
|
414
|
-
const map$
|
|
425
|
+
const map$2 = (arr, f) => arr.map(p => f(p.left, p.right));
|
|
415
426
|
|
|
416
427
|
/* eslint-env browser */
|
|
417
428
|
|
|
@@ -451,7 +462,7 @@
|
|
|
451
462
|
*/
|
|
452
463
|
/* istanbul ignore next */
|
|
453
464
|
const setAttributes = (el, attrs) => {
|
|
454
|
-
forEach(attrs, (key, value) => {
|
|
465
|
+
forEach$1(attrs, (key, value) => {
|
|
455
466
|
if (value === false) {
|
|
456
467
|
el.removeAttribute(key);
|
|
457
468
|
} else if (value === true) {
|
|
@@ -530,7 +541,7 @@
|
|
|
530
541
|
* @return {string}
|
|
531
542
|
*/
|
|
532
543
|
/* istanbul ignore next */
|
|
533
|
-
const mapToStyleString = m => map(m, (value, key) => `${key}:${value};`).join('');
|
|
544
|
+
const mapToStyleString = m => map$3(m, (value, key) => `${key}:${value};`).join('');
|
|
534
545
|
|
|
535
546
|
/**
|
|
536
547
|
* @param {Node} parent
|
|
@@ -540,6 +551,14 @@
|
|
|
540
551
|
/* istanbul ignore next */
|
|
541
552
|
const appendChild = (parent, child) => parent.appendChild(child);
|
|
542
553
|
|
|
554
|
+
doc.ELEMENT_NODE;
|
|
555
|
+
doc.TEXT_NODE;
|
|
556
|
+
doc.CDATA_SECTION_NODE;
|
|
557
|
+
doc.COMMENT_NODE;
|
|
558
|
+
doc.DOCUMENT_NODE;
|
|
559
|
+
doc.DOCUMENT_TYPE_NODE;
|
|
560
|
+
doc.DOCUMENT_FRAGMENT_NODE;
|
|
561
|
+
|
|
543
562
|
/**
|
|
544
563
|
* JSON utility functions.
|
|
545
564
|
*
|
|
@@ -565,21 +584,21 @@
|
|
|
565
584
|
/**
|
|
566
585
|
* @type {Array<function>}
|
|
567
586
|
*/
|
|
568
|
-
let queue = [];
|
|
587
|
+
let queue$1 = [];
|
|
569
588
|
|
|
570
589
|
const _runQueue = () => {
|
|
571
|
-
for (let i = 0; i < queue.length; i++) {
|
|
572
|
-
queue[i]();
|
|
590
|
+
for (let i = 0; i < queue$1.length; i++) {
|
|
591
|
+
queue$1[i]();
|
|
573
592
|
}
|
|
574
|
-
queue = [];
|
|
593
|
+
queue$1 = [];
|
|
575
594
|
};
|
|
576
595
|
|
|
577
596
|
/**
|
|
578
597
|
* @param {function():void} f
|
|
579
598
|
*/
|
|
580
|
-
const enqueue = f => {
|
|
581
|
-
queue.push(f);
|
|
582
|
-
if (queue.length === 1) {
|
|
599
|
+
const enqueue$1 = f => {
|
|
600
|
+
queue$1.push(f);
|
|
601
|
+
if (queue$1.length === 1) {
|
|
583
602
|
setTimeout(_runQueue, 0);
|
|
584
603
|
}
|
|
585
604
|
};
|
|
@@ -666,7 +685,7 @@
|
|
|
666
685
|
* @param {number} b
|
|
667
686
|
* @return {number} The sum of a and b
|
|
668
687
|
*/
|
|
669
|
-
const add = (a, b) => a + b;
|
|
688
|
+
const add$1 = (a, b) => a + b;
|
|
670
689
|
|
|
671
690
|
/**
|
|
672
691
|
* @function
|
|
@@ -684,7 +703,7 @@
|
|
|
684
703
|
*/
|
|
685
704
|
const max = (a, b) => a > b ? a : b;
|
|
686
705
|
|
|
687
|
-
const isNaN = Number.isNaN;
|
|
706
|
+
const isNaN$1 = Number.isNaN;
|
|
688
707
|
/**
|
|
689
708
|
* Base 10 exponential function. Returns the value of 10 raised to the power of pow.
|
|
690
709
|
*
|
|
@@ -817,7 +836,7 @@
|
|
|
817
836
|
* @param {function(ITEM, number, Array<ITEM>):boolean} f
|
|
818
837
|
* @return {boolean}
|
|
819
838
|
*/
|
|
820
|
-
const every = (arr, f) => arr.every(f);
|
|
839
|
+
const every$1 = (arr, f) => arr.every(f);
|
|
821
840
|
|
|
822
841
|
/**
|
|
823
842
|
* @template ELEM
|
|
@@ -826,7 +845,7 @@
|
|
|
826
845
|
* @param {Array<ELEM>} b
|
|
827
846
|
* @return {boolean}
|
|
828
847
|
*/
|
|
829
|
-
const equalFlat = (a, b) => a.length === b.length && every(a, (item, index) => item === b[index]);
|
|
848
|
+
const equalFlat$1 = (a, b) => a.length === b.length && every$1(a, (item, index) => item === b[index]);
|
|
830
849
|
|
|
831
850
|
/**
|
|
832
851
|
* @template ELEM
|
|
@@ -844,7 +863,7 @@
|
|
|
844
863
|
/**
|
|
845
864
|
* @return {Object<string,any>} obj
|
|
846
865
|
*/
|
|
847
|
-
const create$
|
|
866
|
+
const create$4 = () => Object.create(null);
|
|
848
867
|
|
|
849
868
|
/**
|
|
850
869
|
* Object.assign
|
|
@@ -860,7 +879,7 @@
|
|
|
860
879
|
* @param {Object<string,any>} obj
|
|
861
880
|
* @param {function(any,string):any} f
|
|
862
881
|
*/
|
|
863
|
-
const forEach
|
|
882
|
+
const forEach = (obj, f) => {
|
|
864
883
|
for (const key in obj) {
|
|
865
884
|
f(obj[key], key);
|
|
866
885
|
}
|
|
@@ -872,7 +891,7 @@
|
|
|
872
891
|
* @param {function(any,string):R} f
|
|
873
892
|
* @return {Array<R>}
|
|
874
893
|
*/
|
|
875
|
-
const map$
|
|
894
|
+
const map$1 = (obj, f) => {
|
|
876
895
|
const results = [];
|
|
877
896
|
for (const key in obj) {
|
|
878
897
|
results.push(f(obj[key], key));
|
|
@@ -884,7 +903,7 @@
|
|
|
884
903
|
* @param {Object<string,any>} obj
|
|
885
904
|
* @return {number}
|
|
886
905
|
*/
|
|
887
|
-
const length = obj => keys(obj).length;
|
|
906
|
+
const length$1 = obj => keys(obj).length;
|
|
888
907
|
|
|
889
908
|
/**
|
|
890
909
|
* @param {Object<string,any>} obj
|
|
@@ -905,7 +924,7 @@
|
|
|
905
924
|
* @param {function(any,string):boolean} f
|
|
906
925
|
* @return {boolean}
|
|
907
926
|
*/
|
|
908
|
-
const every
|
|
927
|
+
const every = (obj, f) => {
|
|
909
928
|
for (const key in obj) {
|
|
910
929
|
if (!f(obj[key], key)) {
|
|
911
930
|
return false
|
|
@@ -928,7 +947,7 @@
|
|
|
928
947
|
* @param {Object<string,any>} b
|
|
929
948
|
* @return {boolean}
|
|
930
949
|
*/
|
|
931
|
-
const equalFlat
|
|
950
|
+
const equalFlat = (a, b) => a === b || (length$1(a) === length$1(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && b[key] === val));
|
|
932
951
|
|
|
933
952
|
/**
|
|
934
953
|
* Common functions and function call helpers.
|
|
@@ -952,7 +971,7 @@
|
|
|
952
971
|
* @param {Array<T>|object} b
|
|
953
972
|
* @return {boolean}
|
|
954
973
|
*/
|
|
955
|
-
const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((a instanceof Array && equalFlat(a, /** @type {Array<T>} */ (b))) || (typeof a === 'object' && equalFlat
|
|
974
|
+
const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((a instanceof Array && equalFlat$1(a, /** @type {Array<T>} */ (b))) || (typeof a === 'object' && equalFlat(a, b))));
|
|
956
975
|
|
|
957
976
|
/**
|
|
958
977
|
* @param {any} a
|
|
@@ -1008,7 +1027,7 @@
|
|
|
1008
1027
|
break
|
|
1009
1028
|
}
|
|
1010
1029
|
case Object:
|
|
1011
|
-
if (length(a) !== length(b)) {
|
|
1030
|
+
if (length$1(a) !== length$1(b)) {
|
|
1012
1031
|
return false
|
|
1013
1032
|
}
|
|
1014
1033
|
for (const key in a) {
|
|
@@ -1039,29 +1058,29 @@
|
|
|
1039
1058
|
* @module logging
|
|
1040
1059
|
*/
|
|
1041
1060
|
|
|
1042
|
-
const BOLD = create$
|
|
1043
|
-
const UNBOLD = create$
|
|
1044
|
-
const BLUE = create$
|
|
1045
|
-
const GREY = create$
|
|
1046
|
-
const GREEN = create$
|
|
1047
|
-
const RED = create$
|
|
1048
|
-
const PURPLE = create$
|
|
1049
|
-
const ORANGE = create$
|
|
1050
|
-
const UNCOLOR = create$
|
|
1061
|
+
const BOLD = create$6();
|
|
1062
|
+
const UNBOLD = create$6();
|
|
1063
|
+
const BLUE = create$6();
|
|
1064
|
+
const GREY = create$6();
|
|
1065
|
+
const GREEN = create$6();
|
|
1066
|
+
const RED = create$6();
|
|
1067
|
+
const PURPLE = create$6();
|
|
1068
|
+
const ORANGE = create$6();
|
|
1069
|
+
const UNCOLOR = create$6();
|
|
1051
1070
|
|
|
1052
1071
|
/**
|
|
1053
1072
|
* @type {Object<Symbol,pair.Pair<string,string>>}
|
|
1054
1073
|
*/
|
|
1055
1074
|
const _browserStyleMap = {
|
|
1056
|
-
[BOLD]: create$
|
|
1057
|
-
[UNBOLD]: create$
|
|
1058
|
-
[BLUE]: create$
|
|
1059
|
-
[GREEN]: create$
|
|
1060
|
-
[GREY]: create$
|
|
1061
|
-
[RED]: create$
|
|
1062
|
-
[PURPLE]: create$
|
|
1063
|
-
[ORANGE]: create$
|
|
1064
|
-
[UNCOLOR]: create$
|
|
1075
|
+
[BOLD]: create$5('font-weight', 'bold'),
|
|
1076
|
+
[UNBOLD]: create$5('font-weight', 'normal'),
|
|
1077
|
+
[BLUE]: create$5('color', 'blue'),
|
|
1078
|
+
[GREEN]: create$5('color', 'green'),
|
|
1079
|
+
[GREY]: create$5('color', 'grey'),
|
|
1080
|
+
[RED]: create$5('color', 'red'),
|
|
1081
|
+
[PURPLE]: create$5('color', 'purple'),
|
|
1082
|
+
[ORANGE]: create$5('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
1083
|
+
[UNCOLOR]: create$5('color', 'black')
|
|
1065
1084
|
};
|
|
1066
1085
|
|
|
1067
1086
|
const _nodeStyleMap = {
|
|
@@ -1084,7 +1103,7 @@
|
|
|
1084
1103
|
const computeBrowserLoggingArgs = args => {
|
|
1085
1104
|
const strBuilder = [];
|
|
1086
1105
|
const styles = [];
|
|
1087
|
-
const currentStyle = create();
|
|
1106
|
+
const currentStyle = create$7();
|
|
1088
1107
|
/**
|
|
1089
1108
|
* @type {Array<string|Object|number>}
|
|
1090
1109
|
*/
|
|
@@ -1213,7 +1232,7 @@
|
|
|
1213
1232
|
/**
|
|
1214
1233
|
* @param {Array<string|Symbol|Object|number>} args
|
|
1215
1234
|
*/
|
|
1216
|
-
const group = (...args) => {
|
|
1235
|
+
const group$1 = (...args) => {
|
|
1217
1236
|
console.group(...computeLoggingArgs(args));
|
|
1218
1237
|
/* istanbul ignore next */
|
|
1219
1238
|
vconsoles.forEach(vc => vc.group(args));
|
|
@@ -1239,7 +1258,7 @@
|
|
|
1239
1258
|
* @param {HTMLCanvasElement} canvas
|
|
1240
1259
|
* @param {number} height
|
|
1241
1260
|
*/
|
|
1242
|
-
const printCanvas = (canvas, height) => printImg(canvas.toDataURL(), height);
|
|
1261
|
+
const printCanvas$1 = (canvas, height) => printImg(canvas.toDataURL(), height);
|
|
1243
1262
|
|
|
1244
1263
|
const vconsoles = new Set();
|
|
1245
1264
|
|
|
@@ -1262,7 +1281,7 @@
|
|
|
1262
1281
|
} else {
|
|
1263
1282
|
if (arg.constructor === String || arg.constructor === Number) {
|
|
1264
1283
|
// @ts-ignore
|
|
1265
|
-
const span = element('span', [create$
|
|
1284
|
+
const span = element('span', [create$5('style', mapToStyleString(currentStyle))], [text(arg)]);
|
|
1266
1285
|
if (span.innerHTML === '') {
|
|
1267
1286
|
span.innerHTML = ' ';
|
|
1268
1287
|
}
|
|
@@ -1307,11 +1326,11 @@
|
|
|
1307
1326
|
* @param {boolean} collapsed
|
|
1308
1327
|
*/
|
|
1309
1328
|
group (args, collapsed = false) {
|
|
1310
|
-
enqueue(() => {
|
|
1311
|
-
const triangleDown = element('span', [create$
|
|
1312
|
-
const triangleRight = element('span', [create$
|
|
1313
|
-
const content = element('div', [create$
|
|
1314
|
-
const nextContainer = element('div', [create$
|
|
1329
|
+
enqueue$1(() => {
|
|
1330
|
+
const triangleDown = element('span', [create$5('hidden', collapsed), create$5('style', 'color:grey;font-size:120%;')], [text('▼')]);
|
|
1331
|
+
const triangleRight = element('span', [create$5('hidden', !collapsed), create$5('style', 'color:grey;font-size:125%;')], [text('▶')]);
|
|
1332
|
+
const content = element('div', [create$5('style', `${lineStyle};padding-left:${this.depth * 10}px`)], [triangleDown, triangleRight, text(' ')].concat(_computeLineSpans(args)));
|
|
1333
|
+
const nextContainer = element('div', [create$5('hidden', collapsed)]);
|
|
1315
1334
|
const nextLine = element('div', [], [content, nextContainer]);
|
|
1316
1335
|
append(this.ccontainer, [nextLine]);
|
|
1317
1336
|
this.ccontainer = nextContainer;
|
|
@@ -1333,7 +1352,7 @@
|
|
|
1333
1352
|
}
|
|
1334
1353
|
|
|
1335
1354
|
groupEnd () {
|
|
1336
|
-
enqueue(() => {
|
|
1355
|
+
enqueue$1(() => {
|
|
1337
1356
|
if (this.depth > 0) {
|
|
1338
1357
|
this.depth--;
|
|
1339
1358
|
// @ts-ignore
|
|
@@ -1346,8 +1365,8 @@
|
|
|
1346
1365
|
* @param {Array<string|Symbol|Object|number>} args
|
|
1347
1366
|
*/
|
|
1348
1367
|
print (args) {
|
|
1349
|
-
enqueue(() => {
|
|
1350
|
-
append(this.ccontainer, [element('div', [create$
|
|
1368
|
+
enqueue$1(() => {
|
|
1369
|
+
append(this.ccontainer, [element('div', [create$5('style', `${lineStyle};padding-left:${this.depth * 10}px`)], _computeLineSpans(args))]);
|
|
1351
1370
|
});
|
|
1352
1371
|
}
|
|
1353
1372
|
|
|
@@ -1363,8 +1382,8 @@
|
|
|
1363
1382
|
* @param {number} height
|
|
1364
1383
|
*/
|
|
1365
1384
|
printImg (url, height) {
|
|
1366
|
-
enqueue(() => {
|
|
1367
|
-
append(this.ccontainer, [element('img', [create$
|
|
1385
|
+
enqueue$1(() => {
|
|
1386
|
+
append(this.ccontainer, [element('img', [create$5('src', url), create$5('height', `${round(height * 1.5)}px`)])]);
|
|
1368
1387
|
});
|
|
1369
1388
|
}
|
|
1370
1389
|
|
|
@@ -1372,13 +1391,13 @@
|
|
|
1372
1391
|
* @param {Node} node
|
|
1373
1392
|
*/
|
|
1374
1393
|
printDom (node) {
|
|
1375
|
-
enqueue(() => {
|
|
1394
|
+
enqueue$1(() => {
|
|
1376
1395
|
append(this.ccontainer, [node]);
|
|
1377
1396
|
});
|
|
1378
1397
|
}
|
|
1379
1398
|
|
|
1380
1399
|
destroy () {
|
|
1381
|
-
enqueue(() => {
|
|
1400
|
+
enqueue$1(() => {
|
|
1382
1401
|
vconsoles.delete(this);
|
|
1383
1402
|
});
|
|
1384
1403
|
}
|
|
@@ -1447,12 +1466,6 @@
|
|
|
1447
1466
|
}
|
|
1448
1467
|
};
|
|
1449
1468
|
|
|
1450
|
-
/**
|
|
1451
|
-
* @todo Remove in favor of simpleDiffString
|
|
1452
|
-
* @deprecated
|
|
1453
|
-
*/
|
|
1454
|
-
const simpleDiff = simpleDiffString;
|
|
1455
|
-
|
|
1456
1469
|
/**
|
|
1457
1470
|
* Create a diff between two arrays. This diff implementation is highly
|
|
1458
1471
|
* efficient, but not very sophisticated.
|
|
@@ -1488,7 +1501,7 @@
|
|
|
1488
1501
|
};
|
|
1489
1502
|
|
|
1490
1503
|
/* eslint-env browser */
|
|
1491
|
-
const performance = typeof window
|
|
1504
|
+
const performance = typeof window === 'undefined' ? null : (typeof window.performance !== 'undefined' && window.performance) || null;
|
|
1492
1505
|
|
|
1493
1506
|
const isoCrypto = typeof crypto === 'undefined' ? null : crypto;
|
|
1494
1507
|
|
|
@@ -1514,12 +1527,12 @@
|
|
|
1514
1527
|
};
|
|
1515
1528
|
|
|
1516
1529
|
/* istanbul ignore next */
|
|
1517
|
-
const uint32 = () => new Uint32Array(cryptoRandomBuffer(4))[0];
|
|
1530
|
+
const uint32$1 = () => new Uint32Array(cryptoRandomBuffer(4))[0];
|
|
1518
1531
|
|
|
1519
1532
|
// @ts-ignore
|
|
1520
1533
|
const uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11;
|
|
1521
1534
|
const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c =>
|
|
1522
|
-
(c ^ uint32() & 15 >> c / 4).toString(16)
|
|
1535
|
+
(c ^ uint32$1() & 15 >> c / 4).toString(16)
|
|
1523
1536
|
);
|
|
1524
1537
|
|
|
1525
1538
|
/* eslint-env browser */
|
|
@@ -1613,7 +1626,7 @@
|
|
|
1613
1626
|
*/
|
|
1614
1627
|
const BITS32 = 0xFFFFFFFF;
|
|
1615
1628
|
|
|
1616
|
-
var binary = /*#__PURE__*/Object.freeze({
|
|
1629
|
+
var binary$1 = /*#__PURE__*/Object.freeze({
|
|
1617
1630
|
__proto__: null,
|
|
1618
1631
|
BIT1: BIT1,
|
|
1619
1632
|
BIT2: BIT2,
|
|
@@ -1846,7 +1859,7 @@
|
|
|
1846
1859
|
|
|
1847
1860
|
/* istanbul ignore next */
|
|
1848
1861
|
const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && floor(num) === num);
|
|
1849
|
-
const isNaN
|
|
1862
|
+
const isNaN = Number.isNaN;
|
|
1850
1863
|
|
|
1851
1864
|
/**
|
|
1852
1865
|
* Efficient schema-less binary encoding with support for variable length encoding.
|
|
@@ -1903,7 +1916,7 @@
|
|
|
1903
1916
|
* @param {Encoder} encoder
|
|
1904
1917
|
* @return {number}
|
|
1905
1918
|
*/
|
|
1906
|
-
const length
|
|
1919
|
+
const length = encoder => {
|
|
1907
1920
|
let len = encoder.cpos;
|
|
1908
1921
|
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
1909
1922
|
len += encoder.bufs[i].length;
|
|
@@ -1919,7 +1932,7 @@
|
|
|
1919
1932
|
* @return {Uint8Array} The created ArrayBuffer.
|
|
1920
1933
|
*/
|
|
1921
1934
|
const toUint8Array = encoder => {
|
|
1922
|
-
const uint8arr = new Uint8Array(length
|
|
1935
|
+
const uint8arr = new Uint8Array(length(encoder));
|
|
1923
1936
|
let curPos = 0;
|
|
1924
1937
|
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
1925
1938
|
const d = encoder.bufs[i];
|
|
@@ -2218,19 +2231,19 @@
|
|
|
2218
2231
|
* @param {Encoder} encoder
|
|
2219
2232
|
* @param {number} num
|
|
2220
2233
|
*/
|
|
2221
|
-
const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num);
|
|
2234
|
+
const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false);
|
|
2222
2235
|
|
|
2223
2236
|
/**
|
|
2224
2237
|
* @param {Encoder} encoder
|
|
2225
2238
|
* @param {number} num
|
|
2226
2239
|
*/
|
|
2227
|
-
const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num);
|
|
2240
|
+
const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false);
|
|
2228
2241
|
|
|
2229
2242
|
/**
|
|
2230
2243
|
* @param {Encoder} encoder
|
|
2231
2244
|
* @param {bigint} num
|
|
2232
2245
|
*/
|
|
2233
|
-
const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num);
|
|
2246
|
+
const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false);
|
|
2234
2247
|
|
|
2235
2248
|
const floatTestBed = new DataView(new ArrayBuffer(4));
|
|
2236
2249
|
/**
|
|
@@ -2468,6 +2481,7 @@
|
|
|
2468
2481
|
* @param {UintOptRleEncoder} encoder
|
|
2469
2482
|
*/
|
|
2470
2483
|
const flushUintOptRleEncoder = encoder => {
|
|
2484
|
+
/* istanbul ignore else */
|
|
2471
2485
|
if (encoder.count > 0) {
|
|
2472
2486
|
// flush counter, unless this is the first value (count = 0)
|
|
2473
2487
|
// case 1: just a single value. set sign to positive
|
|
@@ -2808,7 +2822,7 @@
|
|
|
2808
2822
|
};
|
|
2809
2823
|
|
|
2810
2824
|
/**
|
|
2811
|
-
* Look ahead without incrementing position
|
|
2825
|
+
* Look ahead without incrementing the position
|
|
2812
2826
|
* to the next byte and read it as unsigned integer.
|
|
2813
2827
|
*
|
|
2814
2828
|
* @function
|
|
@@ -2818,7 +2832,7 @@
|
|
|
2818
2832
|
const peekUint8 = decoder => decoder.arr[decoder.pos];
|
|
2819
2833
|
|
|
2820
2834
|
/**
|
|
2821
|
-
* Look ahead without incrementing position
|
|
2835
|
+
* Look ahead without incrementing the position
|
|
2822
2836
|
* to the next byte and read it as unsigned integer.
|
|
2823
2837
|
*
|
|
2824
2838
|
* @function
|
|
@@ -2830,7 +2844,7 @@
|
|
|
2830
2844
|
(decoder.arr[decoder.pos + 1] << 8);
|
|
2831
2845
|
|
|
2832
2846
|
/**
|
|
2833
|
-
* Look ahead without incrementing position
|
|
2847
|
+
* Look ahead without incrementing the position
|
|
2834
2848
|
* to the next byte and read it as unsigned integer.
|
|
2835
2849
|
*
|
|
2836
2850
|
* @function
|
|
@@ -2876,7 +2890,7 @@
|
|
|
2876
2890
|
* 1/8th of the storage is used as encoding overhead.
|
|
2877
2891
|
* * numbers < 2^7 is stored in one bytlength
|
|
2878
2892
|
* * numbers < 2^14 is stored in two bylength
|
|
2879
|
-
* @todo This should probably create the inverse ~num if
|
|
2893
|
+
* @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change.
|
|
2880
2894
|
*
|
|
2881
2895
|
* @function
|
|
2882
2896
|
* @param {Decoder} decoder
|
|
@@ -2999,17 +3013,17 @@
|
|
|
2999
3013
|
/**
|
|
3000
3014
|
* @param {Decoder} decoder
|
|
3001
3015
|
*/
|
|
3002
|
-
const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0);
|
|
3016
|
+
const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0, false);
|
|
3003
3017
|
|
|
3004
3018
|
/**
|
|
3005
3019
|
* @param {Decoder} decoder
|
|
3006
3020
|
*/
|
|
3007
|
-
const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0);
|
|
3021
|
+
const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0, false);
|
|
3008
3022
|
|
|
3009
3023
|
/**
|
|
3010
3024
|
* @param {Decoder} decoder
|
|
3011
3025
|
*/
|
|
3012
|
-
const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0);
|
|
3026
|
+
const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0, false);
|
|
3013
3027
|
|
|
3014
3028
|
/**
|
|
3015
3029
|
* @type {Array<function(Decoder):any>}
|
|
@@ -3373,7 +3387,7 @@
|
|
|
3373
3387
|
* @param {number} seed A positive 32bit integer. Do not use negative numbers.
|
|
3374
3388
|
* @return {PRNG}
|
|
3375
3389
|
*/
|
|
3376
|
-
const create$
|
|
3390
|
+
const create$3 = seed => new DefaultPRNG(seed);
|
|
3377
3391
|
|
|
3378
3392
|
/**
|
|
3379
3393
|
* Generates a single random bool.
|
|
@@ -3421,7 +3435,7 @@
|
|
|
3421
3435
|
* @param {Number} max The upper bound of the allowed return values (inclusive).
|
|
3422
3436
|
* @return {Number} A random integer on [min, max]
|
|
3423
3437
|
*/
|
|
3424
|
-
const uint32
|
|
3438
|
+
const uint32 = (gen, min, max) => int32(gen, min, max) >>> 0;
|
|
3425
3439
|
|
|
3426
3440
|
/**
|
|
3427
3441
|
* @deprecated
|
|
@@ -3544,7 +3558,7 @@
|
|
|
3544
3558
|
* @param {Array<number>} arr
|
|
3545
3559
|
* @return {number}
|
|
3546
3560
|
*/
|
|
3547
|
-
const average = arr => arr.reduce(add, 0) / arr.length;
|
|
3561
|
+
const average = arr => arr.reduce(add$1, 0) / arr.length;
|
|
3548
3562
|
|
|
3549
3563
|
/**
|
|
3550
3564
|
* Utility helpers to work with promises.
|
|
@@ -3563,7 +3577,7 @@
|
|
|
3563
3577
|
* @param {function(PromiseResolve<T>,function(Error):void):any} f
|
|
3564
3578
|
* @return {Promise<T>}
|
|
3565
3579
|
*/
|
|
3566
|
-
const create$
|
|
3580
|
+
const create$2 = f => /** @type {Promise<T>} */ (new Promise(f));
|
|
3567
3581
|
|
|
3568
3582
|
/**
|
|
3569
3583
|
* @param {function(function():void,function(Error):void):void} f
|
|
@@ -3600,7 +3614,7 @@
|
|
|
3600
3614
|
* @param {number} [intervalResolution]
|
|
3601
3615
|
* @return {Promise<void>}
|
|
3602
3616
|
*/
|
|
3603
|
-
const until = (timeout, check, intervalResolution = 10) => create$
|
|
3617
|
+
const until = (timeout, check, intervalResolution = 10) => create$2((resolve, reject) => {
|
|
3604
3618
|
const startTime = getUnixTime();
|
|
3605
3619
|
const hasTimeout = timeout > 0;
|
|
3606
3620
|
const untilInterval = () => {
|
|
@@ -3622,7 +3636,7 @@
|
|
|
3622
3636
|
* @param {number} timeout
|
|
3623
3637
|
* @return {Promise<undefined>}
|
|
3624
3638
|
*/
|
|
3625
|
-
const wait = timeout => create$
|
|
3639
|
+
const wait = timeout => create$2((resolve, reject) => setTimeout(resolve, timeout));
|
|
3626
3640
|
|
|
3627
3641
|
/**
|
|
3628
3642
|
* Checks if an object is a promise using ducktyping.
|
|
@@ -3716,7 +3730,7 @@
|
|
|
3716
3730
|
/* istanbul ignore else */
|
|
3717
3731
|
if (this._seed === null) {
|
|
3718
3732
|
/* istanbul ignore next */
|
|
3719
|
-
this._seed = envSeed === null ? uint32() : envSeed;
|
|
3733
|
+
this._seed = envSeed === null ? uint32$1() : envSeed;
|
|
3720
3734
|
}
|
|
3721
3735
|
return this._seed
|
|
3722
3736
|
}
|
|
@@ -3729,13 +3743,13 @@
|
|
|
3729
3743
|
get prng () {
|
|
3730
3744
|
/* istanbul ignore else */
|
|
3731
3745
|
if (this._prng === null) {
|
|
3732
|
-
this._prng = create$
|
|
3746
|
+
this._prng = create$3(this.seed);
|
|
3733
3747
|
}
|
|
3734
3748
|
return this._prng
|
|
3735
3749
|
}
|
|
3736
3750
|
}
|
|
3737
3751
|
|
|
3738
|
-
const
|
|
3752
|
+
const repetitionTime = Number(getParam('--repetition-time', '50'));
|
|
3739
3753
|
/* istanbul ignore next */
|
|
3740
3754
|
const testFilter = hasParam('--filter') ? getParam('--filter', '') : null;
|
|
3741
3755
|
|
|
@@ -3765,11 +3779,14 @@
|
|
|
3765
3779
|
if (testFilter === null) {
|
|
3766
3780
|
groupCollapsed(...groupArgs);
|
|
3767
3781
|
} else {
|
|
3768
|
-
group(...groupArgs);
|
|
3782
|
+
group$1(...groupArgs);
|
|
3769
3783
|
}
|
|
3770
3784
|
const times = [];
|
|
3771
3785
|
const start = performance.now();
|
|
3772
3786
|
let lastTime = start;
|
|
3787
|
+
/**
|
|
3788
|
+
* @type {any}
|
|
3789
|
+
*/
|
|
3773
3790
|
let err = null;
|
|
3774
3791
|
performance.mark(`${name}-start`);
|
|
3775
3792
|
do {
|
|
@@ -3784,12 +3801,12 @@
|
|
|
3784
3801
|
const currTime = performance.now();
|
|
3785
3802
|
times.push(currTime - lastTime);
|
|
3786
3803
|
lastTime = currTime;
|
|
3787
|
-
if (repeat && err === null && (lastTime - start) <
|
|
3804
|
+
if (repeat && err === null && (lastTime - start) < repetitionTime) {
|
|
3788
3805
|
tc.resetSeed();
|
|
3789
3806
|
} else {
|
|
3790
3807
|
break
|
|
3791
3808
|
}
|
|
3792
|
-
} while (err === null && (lastTime - start) <
|
|
3809
|
+
} while (err === null && (lastTime - start) < repetitionTime)
|
|
3793
3810
|
performance.mark(`${name}-end`);
|
|
3794
3811
|
/* istanbul ignore if */
|
|
3795
3812
|
if (err !== null && err.constructor !== SkipError) {
|
|
@@ -3805,7 +3822,7 @@
|
|
|
3805
3822
|
? ` - ${window.location.href}?filter=\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}`
|
|
3806
3823
|
: `\nrepeat: npm run test -- --filter "\\[${i + 1}/" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`;
|
|
3807
3824
|
const timeInfo = (repeat && err === null)
|
|
3808
|
-
? ` - ${times.length}
|
|
3825
|
+
? ` - ${times.length} repetitions in ${humanizeDuration(duration)} (best: ${humanizeDuration(times[0])}, worst: ${humanizeDuration(last(times))}, median: ${humanizeDuration(median(times))}, average: ${humanizeDuration(average(times))})`
|
|
3809
3826
|
: ` in ${humanizeDuration(duration)}`;
|
|
3810
3827
|
if (err !== null) {
|
|
3811
3828
|
/* istanbul ignore else */
|
|
@@ -3847,7 +3864,7 @@
|
|
|
3847
3864
|
*/
|
|
3848
3865
|
const info = info => describe('', info);
|
|
3849
3866
|
|
|
3850
|
-
const printCanvas
|
|
3867
|
+
const printCanvas = printCanvas$1;
|
|
3851
3868
|
|
|
3852
3869
|
/**
|
|
3853
3870
|
* Group outputs in a collapsible category.
|
|
@@ -3867,8 +3884,8 @@
|
|
|
3867
3884
|
* @param {string} description
|
|
3868
3885
|
* @param {function(void):void} f
|
|
3869
3886
|
*/
|
|
3870
|
-
const group
|
|
3871
|
-
group(BLUE, description);
|
|
3887
|
+
const group = (description, f) => {
|
|
3888
|
+
group$1(BLUE, description);
|
|
3872
3889
|
try {
|
|
3873
3890
|
f();
|
|
3874
3891
|
} finally {
|
|
@@ -3895,7 +3912,7 @@
|
|
|
3895
3912
|
* @param {function(void):Promise<any>} f
|
|
3896
3913
|
*/
|
|
3897
3914
|
const groupAsync = async (description, f) => {
|
|
3898
|
-
group(BLUE, description);
|
|
3915
|
+
group$1(BLUE, description);
|
|
3899
3916
|
try {
|
|
3900
3917
|
await f();
|
|
3901
3918
|
} finally {
|
|
@@ -3990,7 +4007,7 @@
|
|
|
3990
4007
|
*/
|
|
3991
4008
|
const compareStrings = (a, b, m = 'Strings match') => {
|
|
3992
4009
|
if (a !== b) {
|
|
3993
|
-
const diff =
|
|
4010
|
+
const diff = simpleDiffString(a, b);
|
|
3994
4011
|
print(GREY, a.slice(0, diff.index), RED, a.slice(diff.index, diff.remove), GREEN, diff.insert, GREY, a.slice(diff.index + diff.remove));
|
|
3995
4012
|
fail(m);
|
|
3996
4013
|
}
|
|
@@ -4003,7 +4020,7 @@
|
|
|
4003
4020
|
* @param {string} [m]
|
|
4004
4021
|
* @throws {TestError} Throws if test fails
|
|
4005
4022
|
*/
|
|
4006
|
-
const compareObjects = (a, b, m = 'Objects match') => { equalFlat
|
|
4023
|
+
const compareObjects = (a, b, m = 'Objects match') => { equalFlat(a, b) || fail(m); };
|
|
4007
4024
|
|
|
4008
4025
|
/**
|
|
4009
4026
|
* @param {any} constructor
|
|
@@ -4087,10 +4104,10 @@
|
|
|
4087
4104
|
break
|
|
4088
4105
|
}
|
|
4089
4106
|
case Object:
|
|
4090
|
-
if (length(a) !== length(b)) {
|
|
4107
|
+
if (length$1(a) !== length$1(b)) {
|
|
4091
4108
|
_failMessage(message, 'Objects have a different number of attributes', path);
|
|
4092
4109
|
}
|
|
4093
|
-
forEach
|
|
4110
|
+
forEach(a, (value, key) => {
|
|
4094
4111
|
if (!hasProperty(b, key)) {
|
|
4095
4112
|
_failMessage(message, `Property ${path} does not exist on second argument`, path);
|
|
4096
4113
|
}
|
|
@@ -4153,7 +4170,7 @@
|
|
|
4153
4170
|
* @param {Object<string, Object<string, function(TestCase):void|Promise<any>>>} tests
|
|
4154
4171
|
*/
|
|
4155
4172
|
const runTests = async tests => {
|
|
4156
|
-
const numberOfTests = map$
|
|
4173
|
+
const numberOfTests = map$1(tests, mod => map$1(mod, f => /* istanbul ignore next */ f ? 1 : 0).reduce(add$1, 0)).reduce(add$1, 0);
|
|
4157
4174
|
let successfulTests = 0;
|
|
4158
4175
|
let testnumber = 0;
|
|
4159
4176
|
const start = performance.now();
|
|
@@ -4342,8 +4359,8 @@
|
|
|
4342
4359
|
gen => false, // TYPE 120
|
|
4343
4360
|
gen => utf16String(gen), // TYPE 119
|
|
4344
4361
|
(gen, depth, toJsonCompatible) => ({ val: genAny(gen, depth + 1, toJsonCompatible) }), // TYPE 118
|
|
4345
|
-
(gen, depth, toJsonCompatible) => Array.from({ length: uint32
|
|
4346
|
-
gen => uint8Array(gen, uint32
|
|
4362
|
+
(gen, depth, toJsonCompatible) => Array.from({ length: uint32(gen, 0, 20 - depth) }).map(() => genAny(gen, depth + 1, toJsonCompatible)), // TYPE 117
|
|
4363
|
+
gen => uint8Array(gen, uint32(gen, 0, 50)) // TYPE 116
|
|
4347
4364
|
];
|
|
4348
4365
|
|
|
4349
4366
|
const genAnyLookupTableJsonCompatible = genAnyLookupTable.slice(1);
|
|
@@ -4412,7 +4429,7 @@
|
|
|
4412
4429
|
const reader = createDecoder(toUint8Array(encoder));
|
|
4413
4430
|
const result = read(reader);
|
|
4414
4431
|
const utf8ByteLength$1 = utf8ByteLength(val + '');
|
|
4415
|
-
const binaryByteLength = length
|
|
4432
|
+
const binaryByteLength = length(encoder);
|
|
4416
4433
|
if (doLog) {
|
|
4417
4434
|
describe(testname, ` utf8 encode: ${utf8ByteLength$1} bytes / binary encode: ${binaryByteLength} bytes`);
|
|
4418
4435
|
}
|
|
@@ -4578,7 +4595,7 @@
|
|
|
4578
4595
|
* @param {t.TestCase} tc
|
|
4579
4596
|
*/
|
|
4580
4597
|
const testRepeatVarIntEncoding = tc => {
|
|
4581
|
-
const n = uint32
|
|
4598
|
+
const n = uint32(tc.prng, 0, BITS32);
|
|
4582
4599
|
test(`varInt of ${n}`, writeVarInt, readVarInt, n, false);
|
|
4583
4600
|
};
|
|
4584
4601
|
|
|
@@ -4602,7 +4619,7 @@
|
|
|
4602
4619
|
* @param {t.TestCase} tc
|
|
4603
4620
|
*/
|
|
4604
4621
|
const testRepeatPeekVarIntEncoding = tc => {
|
|
4605
|
-
const n = uint32
|
|
4622
|
+
const n = uint32(tc.prng, 0, BITS32);
|
|
4606
4623
|
test(`varInt of ${n}`, writeVarInt, peekVarInt, n, false);
|
|
4607
4624
|
};
|
|
4608
4625
|
|
|
@@ -4693,12 +4710,12 @@
|
|
|
4693
4710
|
*/
|
|
4694
4711
|
const encodingPairs = [
|
|
4695
4712
|
{ name: 'uint8Array', read: decoder => readUint8Array(decoder, defLen), write: writeUint8Array, gen: gen => uint8Array(gen, defLen), compare: compare },
|
|
4696
|
-
{ name: 'varUint8Array', read: readVarUint8Array, write: writeVarUint8Array, gen: gen => uint8Array(gen, uint32
|
|
4697
|
-
{ name: 'uint8', read: readUint8, write: writeUint8, gen: gen => uint32
|
|
4698
|
-
{ name: 'uint16', read: readUint16, write: writeUint16, gen: gen => uint32
|
|
4699
|
-
{ name: 'uint32', read: readUint32, write: writeUint32, gen: gen => uint32
|
|
4700
|
-
{ name: 'uint32bigEndian', read: readUint32BigEndian, write: writeUint32BigEndian, gen: gen => uint32
|
|
4701
|
-
{ name: 'varString', read: readVarString, write: writeVarString, gen: gen => utf16String(gen, uint32
|
|
4713
|
+
{ name: 'varUint8Array', read: readVarUint8Array, write: writeVarUint8Array, gen: gen => uint8Array(gen, uint32(gen, 0, defLen)), compare: compare },
|
|
4714
|
+
{ name: 'uint8', read: readUint8, write: writeUint8, gen: gen => uint32(gen, 0, BITS8), compare: strictComparison },
|
|
4715
|
+
{ name: 'uint16', read: readUint16, write: writeUint16, gen: gen => uint32(gen, 0, BITS16), compare: strictComparison },
|
|
4716
|
+
{ name: 'uint32', read: readUint32, write: writeUint32, gen: gen => uint32(gen, 0, BITS32), compare: strictComparison },
|
|
4717
|
+
{ name: 'uint32bigEndian', read: readUint32BigEndian, write: writeUint32BigEndian, gen: gen => uint32(gen, 0, BITS32), compare: strictComparison },
|
|
4718
|
+
{ name: 'varString', read: readVarString, write: writeVarString, gen: gen => utf16String(gen, uint32(gen, 0, defLen)), compare: strictComparison },
|
|
4702
4719
|
{ name: 'varUint', read: readVarUint, write: writeVarUint, gen: gen => uint53(gen, 0, BITS32), compare: strictComparison },
|
|
4703
4720
|
{ name: 'varInt', read: readVarInt, write: writeVarInt, gen: gen => int53(gen, LOWEST_INT32, HIGHEST_INT32), compare: strictComparison },
|
|
4704
4721
|
{ name: 'Any', read: readAny, write: writeAny, gen: genAny, compare: compare }
|
|
@@ -4727,7 +4744,7 @@
|
|
|
4727
4744
|
writeUint8Array(encoder, tailData);
|
|
4728
4745
|
const buf = toUint8Array(encoder);
|
|
4729
4746
|
const decoder = createDecoder(buf);
|
|
4730
|
-
assert(length
|
|
4747
|
+
assert(length(encoder) === buf.byteLength);
|
|
4731
4748
|
for (let i = 0; i < ops.length; i++) {
|
|
4732
4749
|
const o = ops[i];
|
|
4733
4750
|
const val = o.read(decoder);
|
|
@@ -4765,7 +4782,7 @@
|
|
|
4765
4782
|
encoder.cpos = initialLen - 2;
|
|
4766
4783
|
writeUint32(encoder, BITS32);
|
|
4767
4784
|
const buf = toUint8Array(encoder);
|
|
4768
|
-
assert(length
|
|
4785
|
+
assert(length(encoder) === initialLen + 2);
|
|
4769
4786
|
const decoder = createDecoder(buf);
|
|
4770
4787
|
const space = createUint8ArrayFromArrayBuffer(readUint8Array(decoder, initialLen - 2));
|
|
4771
4788
|
for (let i = 0; i < initialLen - 2; i++) {
|
|
@@ -5090,7 +5107,7 @@
|
|
|
5090
5107
|
compare([1, 2], [1, 2], 'simple compare (array)');
|
|
5091
5108
|
compare({ a: [1, 2] }, { a: [1, 2] }, 'simple compare nested');
|
|
5092
5109
|
compare(new Set(['3', 1234]), new Set(['3', 1234]), 'compare Sets');
|
|
5093
|
-
const map1 = create();
|
|
5110
|
+
const map1 = create$7();
|
|
5094
5111
|
map1.set(1, 2);
|
|
5095
5112
|
map1.set('x', {});
|
|
5096
5113
|
map1.set(98, 'tst');
|
|
@@ -5194,17 +5211,17 @@
|
|
|
5194
5211
|
};
|
|
5195
5212
|
|
|
5196
5213
|
const testAsync = async () => {
|
|
5197
|
-
await measureTimeAsync('time', () => create$
|
|
5214
|
+
await measureTimeAsync('time', () => create$2(r => setTimeout(r)));
|
|
5198
5215
|
await groupAsync('some description', () => wait(1));
|
|
5199
5216
|
};
|
|
5200
5217
|
|
|
5201
|
-
const
|
|
5218
|
+
const testRepeatRepetition = () => {
|
|
5202
5219
|
const arr = [];
|
|
5203
5220
|
const n = 100;
|
|
5204
5221
|
for (let i = 1; i <= n; i++) {
|
|
5205
5222
|
arr.push(i);
|
|
5206
5223
|
}
|
|
5207
|
-
assert(arr.reduce(add, 0) === (n + 1) * n / 2);
|
|
5224
|
+
assert(arr.reduce(add$1, 0) === (n + 1) * n / 2);
|
|
5208
5225
|
};
|
|
5209
5226
|
|
|
5210
5227
|
var testing = /*#__PURE__*/Object.freeze({
|
|
@@ -5213,7 +5230,7 @@
|
|
|
5213
5230
|
testFailing: testFailing,
|
|
5214
5231
|
testSkipping: testSkipping,
|
|
5215
5232
|
testAsync: testAsync,
|
|
5216
|
-
|
|
5233
|
+
testRepeatRepetition: testRepeatRepetition
|
|
5217
5234
|
});
|
|
5218
5235
|
|
|
5219
5236
|
/**
|
|
@@ -5222,23 +5239,23 @@
|
|
|
5222
5239
|
* @module error
|
|
5223
5240
|
*/
|
|
5224
5241
|
|
|
5242
|
+
/* istanbul ignore next */
|
|
5225
5243
|
/**
|
|
5226
5244
|
* @param {string} s
|
|
5227
5245
|
* @return {Error}
|
|
5228
5246
|
*/
|
|
5229
|
-
|
|
5230
|
-
const create$6 = s => new Error(s);
|
|
5247
|
+
const create$1 = s => new Error(s);
|
|
5231
5248
|
|
|
5232
5249
|
/* eslint-env browser */
|
|
5233
5250
|
|
|
5251
|
+
/* istanbul ignore next */
|
|
5234
5252
|
/**
|
|
5235
5253
|
* IDB Request to Promise transformer
|
|
5236
5254
|
*
|
|
5237
5255
|
* @param {IDBRequest} request
|
|
5238
5256
|
* @return {Promise<any>}
|
|
5239
5257
|
*/
|
|
5240
|
-
|
|
5241
|
-
const rtop = request => create$5((resolve, reject) => {
|
|
5258
|
+
const rtop = request => create$2((resolve, reject) => {
|
|
5242
5259
|
/* istanbul ignore next */
|
|
5243
5260
|
// @ts-ignore
|
|
5244
5261
|
request.onerror = event => reject(new Error(event.target.error));
|
|
@@ -5249,13 +5266,13 @@
|
|
|
5249
5266
|
request.onsuccess = event => resolve(event.target.result);
|
|
5250
5267
|
});
|
|
5251
5268
|
|
|
5269
|
+
/* istanbul ignore next */
|
|
5252
5270
|
/**
|
|
5253
5271
|
* @param {string} name
|
|
5254
5272
|
* @param {function(IDBDatabase):any} initDB Called when the database is first created
|
|
5255
5273
|
* @return {Promise<IDBDatabase>}
|
|
5256
5274
|
*/
|
|
5257
|
-
|
|
5258
|
-
const openDB = (name, initDB) => create$5((resolve, reject) => {
|
|
5275
|
+
const openDB = (name, initDB) => create$2((resolve, reject) => {
|
|
5259
5276
|
const request = indexedDB.open(name);
|
|
5260
5277
|
/**
|
|
5261
5278
|
* @param {any} event
|
|
@@ -5265,7 +5282,7 @@
|
|
|
5265
5282
|
/**
|
|
5266
5283
|
* @param {any} event
|
|
5267
5284
|
*/
|
|
5268
|
-
request.onerror = event => reject(create$
|
|
5285
|
+
request.onerror = event => reject(create$1(event.target.error));
|
|
5269
5286
|
/* istanbul ignore next */
|
|
5270
5287
|
request.onblocked = () => location.reload();
|
|
5271
5288
|
/**
|
|
@@ -5286,82 +5303,82 @@
|
|
|
5286
5303
|
};
|
|
5287
5304
|
});
|
|
5288
5305
|
|
|
5306
|
+
/* istanbul ignore next */
|
|
5289
5307
|
/**
|
|
5290
5308
|
* @param {string} name
|
|
5291
5309
|
*/
|
|
5292
|
-
/* istanbul ignore next */
|
|
5293
5310
|
const deleteDB = name => rtop(indexedDB.deleteDatabase(name));
|
|
5294
5311
|
|
|
5312
|
+
/* istanbul ignore next */
|
|
5295
5313
|
/**
|
|
5296
5314
|
* @param {IDBDatabase} db
|
|
5297
5315
|
* @param {Array<Array<string>|Array<string|IDBObjectStoreParameters|undefined>>} definitions
|
|
5298
5316
|
*/
|
|
5299
|
-
/* istanbul ignore next */
|
|
5300
5317
|
const createStores = (db, definitions) => definitions.forEach(d =>
|
|
5301
5318
|
// @ts-ignore
|
|
5302
5319
|
db.createObjectStore.apply(db, d)
|
|
5303
5320
|
);
|
|
5304
5321
|
|
|
5322
|
+
/* istanbul ignore next */
|
|
5305
5323
|
/**
|
|
5306
5324
|
* @param {IDBObjectStore} store
|
|
5307
5325
|
* @param {String | number | ArrayBuffer | Date | Array<any> } key
|
|
5308
5326
|
* @return {Promise<String | number | ArrayBuffer | Date | Array<any>>}
|
|
5309
5327
|
*/
|
|
5310
|
-
/* istanbul ignore next */
|
|
5311
5328
|
const get = (store, key) =>
|
|
5312
5329
|
rtop(store.get(key));
|
|
5313
5330
|
|
|
5331
|
+
/* istanbul ignore next */
|
|
5314
5332
|
/**
|
|
5315
5333
|
* @param {IDBObjectStore} store
|
|
5316
5334
|
* @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array<any> } key
|
|
5317
5335
|
*/
|
|
5318
|
-
/* istanbul ignore next */
|
|
5319
5336
|
const del = (store, key) =>
|
|
5320
5337
|
rtop(store.delete(key));
|
|
5321
5338
|
|
|
5339
|
+
/* istanbul ignore next */
|
|
5322
5340
|
/**
|
|
5323
5341
|
* @param {IDBObjectStore} store
|
|
5324
5342
|
* @param {String | number | ArrayBuffer | Date | boolean} item
|
|
5325
5343
|
* @param {String | number | ArrayBuffer | Date | Array<any>} [key]
|
|
5326
5344
|
*/
|
|
5327
|
-
/* istanbul ignore next */
|
|
5328
5345
|
const put = (store, item, key) =>
|
|
5329
5346
|
rtop(store.put(item, key));
|
|
5330
5347
|
|
|
5348
|
+
/* istanbul ignore next */
|
|
5331
5349
|
/**
|
|
5332
5350
|
* @param {IDBObjectStore} store
|
|
5333
5351
|
* @param {String | number | ArrayBuffer | Date | boolean} item
|
|
5334
5352
|
* @param {String | number | ArrayBuffer | Date | Array<any>} key
|
|
5335
5353
|
* @return {Promise<any>}
|
|
5336
5354
|
*/
|
|
5337
|
-
|
|
5338
|
-
const add$1 = (store, item, key) =>
|
|
5355
|
+
const add = (store, item, key) =>
|
|
5339
5356
|
rtop(store.add(item, key));
|
|
5340
5357
|
|
|
5358
|
+
/* istanbul ignore next */
|
|
5341
5359
|
/**
|
|
5342
5360
|
* @param {IDBObjectStore} store
|
|
5343
5361
|
* @param {String | number | ArrayBuffer | Date} item
|
|
5344
5362
|
* @return {Promise<number>} Returns the generated key
|
|
5345
5363
|
*/
|
|
5346
|
-
/* istanbul ignore next */
|
|
5347
5364
|
const addAutoKey = (store, item) =>
|
|
5348
5365
|
rtop(store.add(item));
|
|
5349
5366
|
|
|
5367
|
+
/* istanbul ignore next */
|
|
5350
5368
|
/**
|
|
5351
5369
|
* @param {IDBObjectStore} store
|
|
5352
5370
|
* @param {IDBKeyRange} [range]
|
|
5353
5371
|
* @return {Promise<Array<any>>}
|
|
5354
5372
|
*/
|
|
5355
|
-
/* istanbul ignore next */
|
|
5356
5373
|
const getAll = (store, range) =>
|
|
5357
5374
|
rtop(store.getAll(range));
|
|
5358
5375
|
|
|
5376
|
+
/* istanbul ignore next */
|
|
5359
5377
|
/**
|
|
5360
5378
|
* @param {IDBObjectStore} store
|
|
5361
5379
|
* @param {IDBKeyRange} [range]
|
|
5362
5380
|
* @return {Promise<Array<any>>}
|
|
5363
5381
|
*/
|
|
5364
|
-
/* istanbul ignore next */
|
|
5365
5382
|
const getAllKeys = (store, range) =>
|
|
5366
5383
|
rtop(store.getAllKeys(range));
|
|
5367
5384
|
|
|
@@ -5372,23 +5389,23 @@
|
|
|
5372
5389
|
* @property {any} v Value
|
|
5373
5390
|
*/
|
|
5374
5391
|
|
|
5392
|
+
/* istanbul ignore next */
|
|
5375
5393
|
/**
|
|
5376
5394
|
* @param {IDBObjectStore} store
|
|
5377
5395
|
* @param {IDBKeyRange} [range]
|
|
5378
5396
|
* @return {Promise<Array<KeyValuePair>>}
|
|
5379
5397
|
*/
|
|
5380
|
-
/* istanbul ignore next */
|
|
5381
5398
|
const getAllKeysValues = (store, range) =>
|
|
5382
5399
|
// @ts-ignore
|
|
5383
5400
|
all([getAllKeys(store, range), getAll(store, range)]).then(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] })));
|
|
5384
5401
|
|
|
5402
|
+
/* istanbul ignore next */
|
|
5385
5403
|
/**
|
|
5386
5404
|
* @param {any} request
|
|
5387
5405
|
* @param {function(IDBCursorWithValue):void|boolean} f
|
|
5388
5406
|
* @return {Promise<void>}
|
|
5389
5407
|
*/
|
|
5390
|
-
|
|
5391
|
-
const iterateOnRequest = (request, f) => create$5((resolve, reject) => {
|
|
5408
|
+
const iterateOnRequest = (request, f) => create$2((resolve, reject) => {
|
|
5392
5409
|
/* istanbul ignore next */
|
|
5393
5410
|
request.onerror = reject;
|
|
5394
5411
|
/**
|
|
@@ -5403,6 +5420,7 @@
|
|
|
5403
5420
|
};
|
|
5404
5421
|
});
|
|
5405
5422
|
|
|
5423
|
+
/* istanbul ignore next */
|
|
5406
5424
|
/**
|
|
5407
5425
|
* Iterate on keys and values
|
|
5408
5426
|
* @param {IDBObjectStore} store
|
|
@@ -5410,10 +5428,10 @@
|
|
|
5410
5428
|
* @param {function(any,any):void|boolean} f Callback that receives (value, key)
|
|
5411
5429
|
* @param {'next'|'prev'|'nextunique'|'prevunique'} direction
|
|
5412
5430
|
*/
|
|
5413
|
-
/* istanbul ignore next */
|
|
5414
5431
|
const iterate = (store, keyrange, f, direction = 'next') =>
|
|
5415
5432
|
iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key));
|
|
5416
5433
|
|
|
5434
|
+
/* istanbul ignore next */
|
|
5417
5435
|
/**
|
|
5418
5436
|
* Iterate on the keys (no values)
|
|
5419
5437
|
*
|
|
@@ -5422,26 +5440,25 @@
|
|
|
5422
5440
|
* @param {function(any):void|boolean} f callback that receives the key
|
|
5423
5441
|
* @param {'next'|'prev'|'nextunique'|'prevunique'} direction
|
|
5424
5442
|
*/
|
|
5425
|
-
/* istanbul ignore next */
|
|
5426
5443
|
const iterateKeys = (store, keyrange, f, direction = 'next') =>
|
|
5427
5444
|
iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key));
|
|
5428
5445
|
|
|
5446
|
+
/* istanbul ignore next */
|
|
5429
5447
|
/**
|
|
5430
5448
|
* Open store from transaction
|
|
5431
5449
|
* @param {IDBTransaction} t
|
|
5432
5450
|
* @param {String} store
|
|
5433
5451
|
* @returns {IDBObjectStore}
|
|
5434
5452
|
*/
|
|
5435
|
-
|
|
5436
|
-
const getStore = (t, store) => t.objectStore(store);
|
|
5453
|
+
const getStore$1 = (t, store) => t.objectStore(store);
|
|
5437
5454
|
|
|
5455
|
+
/* istanbul ignore next */
|
|
5438
5456
|
/**
|
|
5439
5457
|
* @param {any} lower
|
|
5440
5458
|
* @param {any} upper
|
|
5441
5459
|
* @param {boolean} lowerOpen
|
|
5442
5460
|
* @param {boolean} upperOpen
|
|
5443
5461
|
*/
|
|
5444
|
-
/* istanbul ignore next */
|
|
5445
5462
|
const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);
|
|
5446
5463
|
|
|
5447
5464
|
/* istanbul ignore next */
|
|
@@ -5462,7 +5479,7 @@
|
|
|
5462
5479
|
* @param {IDBTransaction} t
|
|
5463
5480
|
* @return {IDBObjectStore}
|
|
5464
5481
|
*/
|
|
5465
|
-
const getStore
|
|
5482
|
+
const getStore = t => getStore$1(t, 'test');
|
|
5466
5483
|
|
|
5467
5484
|
/* istanbul ignore next */
|
|
5468
5485
|
const testRetrieveElements = async () => {
|
|
@@ -5471,7 +5488,7 @@
|
|
|
5471
5488
|
await deleteDB(testDBName);
|
|
5472
5489
|
const db = await openDB(testDBName, initTestDB);
|
|
5473
5490
|
const transaction = createTransaction(db);
|
|
5474
|
-
const store = getStore
|
|
5491
|
+
const store = getStore(transaction);
|
|
5475
5492
|
await put(store, 0, ['t', 1]);
|
|
5476
5493
|
await put(store, 1, ['t', 2]);
|
|
5477
5494
|
const expectedKeys = [['t', 1], ['t', 2]];
|
|
@@ -5526,7 +5543,7 @@
|
|
|
5526
5543
|
const getVDel = await get(store, ['t', 0]);
|
|
5527
5544
|
assert(getVDel === undefined);
|
|
5528
5545
|
describe('idb.add');
|
|
5529
|
-
await add
|
|
5546
|
+
await add(store, 99, 42);
|
|
5530
5547
|
const idbVAdd = await get(store, 42);
|
|
5531
5548
|
assert(idbVAdd === 99);
|
|
5532
5549
|
describe('idb.addAutoKey');
|
|
@@ -5623,7 +5640,7 @@
|
|
|
5623
5640
|
* @param {prng.PRNG} gen
|
|
5624
5641
|
*/
|
|
5625
5642
|
const runGenTest = (tc, gen) => {
|
|
5626
|
-
group
|
|
5643
|
+
group('next - average distribution', () => {
|
|
5627
5644
|
let sum = 0;
|
|
5628
5645
|
for (let i = 0; i < genTestData; i++) {
|
|
5629
5646
|
const next = gen.next();
|
|
@@ -5637,7 +5654,7 @@
|
|
|
5637
5654
|
assert(avg <= 0.55);
|
|
5638
5655
|
});
|
|
5639
5656
|
|
|
5640
|
-
group
|
|
5657
|
+
group('bool - bool distribution is fair', () => {
|
|
5641
5658
|
let head = 0;
|
|
5642
5659
|
let tail = 0;
|
|
5643
5660
|
let b;
|
|
@@ -5655,12 +5672,12 @@
|
|
|
5655
5672
|
assert(tail >= floor(genTestData * 0.45), 'Generated enough tails.');
|
|
5656
5673
|
assert(head >= floor(genTestData * 0.45), 'Generated enough heads.');
|
|
5657
5674
|
});
|
|
5658
|
-
group
|
|
5675
|
+
group('int31 - integers average correctly', () => {
|
|
5659
5676
|
let count = 0;
|
|
5660
5677
|
let i;
|
|
5661
5678
|
|
|
5662
5679
|
for (i = 0; i < genTestData; i++) {
|
|
5663
|
-
count += uint32
|
|
5680
|
+
count += uint32(gen, 0, 100);
|
|
5664
5681
|
}
|
|
5665
5682
|
const average = count / genTestData;
|
|
5666
5683
|
const expectedAverage = 100 / 2;
|
|
@@ -5668,7 +5685,7 @@
|
|
|
5668
5685
|
assert(abs(average - expectedAverage) <= 2, 'Expected average is at most 1 off.');
|
|
5669
5686
|
});
|
|
5670
5687
|
|
|
5671
|
-
group
|
|
5688
|
+
group('int32 - generates integer with 32 bits', () => {
|
|
5672
5689
|
let largest = 0;
|
|
5673
5690
|
let smallest = 0;
|
|
5674
5691
|
let i;
|
|
@@ -5689,12 +5706,12 @@
|
|
|
5689
5706
|
assert((smallest & BIT32) !== 0, 'Largest number is 32 bits long'); // largest.. assuming we convert int to uint
|
|
5690
5707
|
});
|
|
5691
5708
|
|
|
5692
|
-
group
|
|
5709
|
+
group('uint32 - generates unsigned integer with 32 bits', () => {
|
|
5693
5710
|
let num = 0;
|
|
5694
5711
|
let i;
|
|
5695
5712
|
let newNum;
|
|
5696
5713
|
for (i = 0; i < genTestData; i++) {
|
|
5697
|
-
newNum = uint32
|
|
5714
|
+
newNum = uint32(gen, 0, BITS32);
|
|
5698
5715
|
if (newNum > num) {
|
|
5699
5716
|
num = newNum;
|
|
5700
5717
|
}
|
|
@@ -5703,7 +5720,7 @@
|
|
|
5703
5720
|
assert((num & BIT32) !== 0, 'Largest number is 32 bits long.');
|
|
5704
5721
|
});
|
|
5705
5722
|
|
|
5706
|
-
group
|
|
5723
|
+
group('int53 - generates integer exceeding 32 bits', () => {
|
|
5707
5724
|
let largest = 0;
|
|
5708
5725
|
let smallest = 0;
|
|
5709
5726
|
let i;
|
|
@@ -5725,7 +5742,7 @@
|
|
|
5725
5742
|
assert(smallest < BITS32, 'Smallest Number is smaller than BITS32 (negative)');
|
|
5726
5743
|
});
|
|
5727
5744
|
|
|
5728
|
-
group
|
|
5745
|
+
group('uint53 - generates integer exceeding 32 bits', () => {
|
|
5729
5746
|
let largest = 0;
|
|
5730
5747
|
let smallest = 10000;
|
|
5731
5748
|
let i;
|
|
@@ -5747,12 +5764,12 @@
|
|
|
5747
5764
|
assert(largest > (BITS32 >>> 0), 'Largest number exceeds BITS32');
|
|
5748
5765
|
});
|
|
5749
5766
|
|
|
5750
|
-
group
|
|
5767
|
+
group('int31 - generates integer with 31 bits', () => {
|
|
5751
5768
|
let num = 0;
|
|
5752
5769
|
let i;
|
|
5753
5770
|
let newNum;
|
|
5754
5771
|
for (i = 0; i < genTestData; i++) {
|
|
5755
|
-
newNum = uint32
|
|
5772
|
+
newNum = uint32(gen, 0, BITS31);
|
|
5756
5773
|
if (newNum > num) {
|
|
5757
5774
|
num = newNum;
|
|
5758
5775
|
}
|
|
@@ -5761,7 +5778,7 @@
|
|
|
5761
5778
|
assert((num & BIT31) !== 0, 'Largest number is 31 bits long.');
|
|
5762
5779
|
});
|
|
5763
5780
|
|
|
5764
|
-
group
|
|
5781
|
+
group('real - has 53 bit resolution', () => {
|
|
5765
5782
|
let num = 0;
|
|
5766
5783
|
let i;
|
|
5767
5784
|
let newNum;
|
|
@@ -5775,7 +5792,7 @@
|
|
|
5775
5792
|
assert((MAX_SAFE_INTEGER - num) / MAX_SAFE_INTEGER < 0.01, 'Largest number is close to MAX_SAFE_INTEGER (at most 1% off).');
|
|
5776
5793
|
});
|
|
5777
5794
|
|
|
5778
|
-
group
|
|
5795
|
+
group('char - generates all ascii characters', () => {
|
|
5779
5796
|
const charSet = new Set();
|
|
5780
5797
|
const chars = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~"';
|
|
5781
5798
|
for (let i = chars.length - 1; i >= 0; i--) {
|
|
@@ -5829,7 +5846,7 @@
|
|
|
5829
5846
|
const y = int32(gen, 0, DIAMETER);
|
|
5830
5847
|
ctx.fillRect(x, y, 1, 2);
|
|
5831
5848
|
}
|
|
5832
|
-
printCanvas
|
|
5849
|
+
printCanvas(canvas$1, DIAMETER);
|
|
5833
5850
|
};
|
|
5834
5851
|
|
|
5835
5852
|
/* istanbul ignore next */
|
|
@@ -5838,9 +5855,9 @@
|
|
|
5838
5855
|
*/
|
|
5839
5856
|
const testNumberDistributions = tc => {
|
|
5840
5857
|
skip(!isBrowser);
|
|
5841
|
-
group
|
|
5842
|
-
group
|
|
5843
|
-
group
|
|
5858
|
+
group('Xoroshiro128plus', () => printDistribution(new Xoroshiro128plus(tc.seed), tc));
|
|
5859
|
+
group('Xorshift32', () => printDistribution(new Xorshift32(tc.seed), tc));
|
|
5860
|
+
group('MT19937', () => printDistribution(new Mt19937(tc.seed), tc));
|
|
5844
5861
|
};
|
|
5845
5862
|
|
|
5846
5863
|
var prng = /*#__PURE__*/Object.freeze({
|
|
@@ -5855,7 +5872,7 @@
|
|
|
5855
5872
|
* @param {t.TestCase} tc
|
|
5856
5873
|
*/
|
|
5857
5874
|
const testMedian = tc => {
|
|
5858
|
-
assert(isNaN(median([])), 'median([]) = NaN');
|
|
5875
|
+
assert(isNaN$1(median([])), 'median([]) = NaN');
|
|
5859
5876
|
assert(median([1]) === 1, 'median([x]) = x');
|
|
5860
5877
|
assert(median([1, 2, 3]) === 2, 'median([a,b,c]) = b');
|
|
5861
5878
|
assert(median([1, 2, 3, 4]) === (2 + 3) / 2, 'median([a,b,c,d]) = (b+c)/2');
|
|
@@ -5874,7 +5891,7 @@
|
|
|
5874
5891
|
const testBitx = tc => {
|
|
5875
5892
|
for (let i = 1; i <= 32; i++) {
|
|
5876
5893
|
// @ts-ignore
|
|
5877
|
-
assert(binary[`BIT${i}`] === (1 << (i - 1)), `BIT${i}=${1 << (i - 1)}`);
|
|
5894
|
+
assert(binary$1[`BIT${i}`] === (1 << (i - 1)), `BIT${i}=${1 << (i - 1)}`);
|
|
5878
5895
|
}
|
|
5879
5896
|
};
|
|
5880
5897
|
|
|
@@ -5886,13 +5903,13 @@
|
|
|
5886
5903
|
for (let i = 1; i < 32; i++) {
|
|
5887
5904
|
const expected = ((1 << i) - 1) >>> 0;
|
|
5888
5905
|
// @ts-ignore
|
|
5889
|
-
const have = binary[`BITS${i}`];
|
|
5906
|
+
const have = binary$1[`BITS${i}`];
|
|
5890
5907
|
assert(have === expected, `BITS${i}=${have}=${expected}`);
|
|
5891
5908
|
}
|
|
5892
5909
|
assert(BITS32 === 0xFFFFFFFF);
|
|
5893
5910
|
};
|
|
5894
5911
|
|
|
5895
|
-
var binary
|
|
5912
|
+
var binary = /*#__PURE__*/Object.freeze({
|
|
5896
5913
|
__proto__: null,
|
|
5897
5914
|
testBitx: testBitx,
|
|
5898
5915
|
testBitsx: testBitsx
|
|
@@ -5909,7 +5926,7 @@
|
|
|
5909
5926
|
let lenSum = 0;
|
|
5910
5927
|
let ones = 0;
|
|
5911
5928
|
for (let i = 0; i < iterations; i++) {
|
|
5912
|
-
newNum = uint32();
|
|
5929
|
+
newNum = uint32$1();
|
|
5913
5930
|
lenSum += newNum.toString().length;
|
|
5914
5931
|
ones += newNum.toString(2).split('').filter(x => x === '1').length;
|
|
5915
5932
|
if (newNum > largest) {
|
|
@@ -5981,7 +5998,7 @@
|
|
|
5981
5998
|
* @param {Promise<T>} p
|
|
5982
5999
|
* @return {Promise<T>}
|
|
5983
6000
|
*/
|
|
5984
|
-
const failsP = p => create$
|
|
6001
|
+
const failsP = p => create$2((resolve, reject) => p.then(() => reject(create$1('Promise should fail')), resolve));
|
|
5985
6002
|
|
|
5986
6003
|
/**
|
|
5987
6004
|
* @param {t.TestCase} tc
|
|
@@ -6007,7 +6024,7 @@
|
|
|
6007
6024
|
*/
|
|
6008
6025
|
const testispromise = tc => {
|
|
6009
6026
|
assert(isPromise(new Promise(() => {})));
|
|
6010
|
-
assert(isPromise(create$
|
|
6027
|
+
assert(isPromise(create$2(() => {})));
|
|
6011
6028
|
const rej = reject();
|
|
6012
6029
|
assert(isPromise(rej));
|
|
6013
6030
|
rej.catch(() => {});
|
|
@@ -6052,7 +6069,7 @@
|
|
|
6052
6069
|
*
|
|
6053
6070
|
* @return {Queue}
|
|
6054
6071
|
*/
|
|
6055
|
-
const create
|
|
6072
|
+
const create = () => new Queue();
|
|
6056
6073
|
|
|
6057
6074
|
/**
|
|
6058
6075
|
* @param {Queue} queue
|
|
@@ -6063,7 +6080,7 @@
|
|
|
6063
6080
|
* @param {Queue} queue
|
|
6064
6081
|
* @param {QueueNode} n
|
|
6065
6082
|
*/
|
|
6066
|
-
const enqueue
|
|
6083
|
+
const enqueue = (queue, n) => {
|
|
6067
6084
|
if (queue.end !== null) {
|
|
6068
6085
|
queue.end.next = n;
|
|
6069
6086
|
queue.end = n;
|
|
@@ -6105,11 +6122,11 @@
|
|
|
6105
6122
|
/**
|
|
6106
6123
|
* @type {queue.Queue}
|
|
6107
6124
|
*/
|
|
6108
|
-
const q = create
|
|
6125
|
+
const q = create();
|
|
6109
6126
|
assert(isEmpty(q));
|
|
6110
6127
|
assert(dequeue(q) === null);
|
|
6111
6128
|
for (let i = 0; i < N; i++) {
|
|
6112
|
-
enqueue
|
|
6129
|
+
enqueue(q, new QueueItem(i));
|
|
6113
6130
|
assert(!isEmpty(q));
|
|
6114
6131
|
}
|
|
6115
6132
|
for (let i = 0; i < N; i++) {
|
|
@@ -6119,7 +6136,7 @@
|
|
|
6119
6136
|
assert(dequeue(q) === null);
|
|
6120
6137
|
};
|
|
6121
6138
|
|
|
6122
|
-
var queue
|
|
6139
|
+
var queue = /*#__PURE__*/Object.freeze({
|
|
6123
6140
|
__proto__: null,
|
|
6124
6141
|
testEnqueueDequeue: testEnqueueDequeue
|
|
6125
6142
|
});
|
|
@@ -6128,10 +6145,10 @@
|
|
|
6128
6145
|
* @param {t.TestCase} tc
|
|
6129
6146
|
*/
|
|
6130
6147
|
const testMap = tc => {
|
|
6131
|
-
const m = create();
|
|
6148
|
+
const m = create$7();
|
|
6132
6149
|
m.set(1, 2);
|
|
6133
6150
|
m.set(2, 3);
|
|
6134
|
-
assert(map(m, (value, key) => value * 2 + key).reduce(add) === 13);
|
|
6151
|
+
assert(map$3(m, (value, key) => value * 2 + key).reduce(add$1) === 13);
|
|
6135
6152
|
let numberOfWrites = 0;
|
|
6136
6153
|
const createT = () => {
|
|
6137
6154
|
numberOfWrites++;
|
|
@@ -6144,7 +6161,7 @@
|
|
|
6144
6161
|
assert(numberOfWrites === 1);
|
|
6145
6162
|
};
|
|
6146
6163
|
|
|
6147
|
-
var map
|
|
6164
|
+
var map = /*#__PURE__*/Object.freeze({
|
|
6148
6165
|
__proto__: null,
|
|
6149
6166
|
testMap: testMap
|
|
6150
6167
|
});
|
|
@@ -6156,16 +6173,16 @@
|
|
|
6156
6173
|
let currI = 0;
|
|
6157
6174
|
for (let i = 0; i < 10; i++) {
|
|
6158
6175
|
const bi = i;
|
|
6159
|
-
enqueue(() => {
|
|
6176
|
+
enqueue$1(() => {
|
|
6160
6177
|
assert(currI++ === bi);
|
|
6161
6178
|
});
|
|
6162
6179
|
}
|
|
6163
|
-
enqueue(() => {
|
|
6180
|
+
enqueue$1(() => {
|
|
6164
6181
|
assert(currI === 10);
|
|
6165
6182
|
});
|
|
6166
6183
|
assert(currI === 0);
|
|
6167
6184
|
return all([
|
|
6168
|
-
createEmpty(resolve => enqueue(resolve)),
|
|
6185
|
+
createEmpty(resolve => enqueue$1(resolve)),
|
|
6169
6186
|
until(0, () => currI === 10)
|
|
6170
6187
|
])
|
|
6171
6188
|
};
|
|
@@ -6179,7 +6196,7 @@
|
|
|
6179
6196
|
set = true;
|
|
6180
6197
|
});
|
|
6181
6198
|
timeout$1.destroy();
|
|
6182
|
-
await create$
|
|
6199
|
+
await create$2(resolve => {
|
|
6183
6200
|
timeout(10, resolve);
|
|
6184
6201
|
});
|
|
6185
6202
|
assert(set === false);
|
|
@@ -6217,7 +6234,7 @@
|
|
|
6217
6234
|
* @param {t.TestCase} tc
|
|
6218
6235
|
*/
|
|
6219
6236
|
const testIdleCallback = async tc => {
|
|
6220
|
-
await create$
|
|
6237
|
+
await create$2(resolve => {
|
|
6221
6238
|
idleCallback(resolve);
|
|
6222
6239
|
});
|
|
6223
6240
|
};
|
|
@@ -6272,18 +6289,18 @@
|
|
|
6272
6289
|
* @param {t.TestCase} tc
|
|
6273
6290
|
*/
|
|
6274
6291
|
const testPair = tc => {
|
|
6275
|
-
const ps = [create$
|
|
6292
|
+
const ps = [create$5(1, 2), create$5(3, 4), createReversed(6, 5)];
|
|
6276
6293
|
describe('Counting elements in pair list');
|
|
6277
6294
|
let countLeft = 0;
|
|
6278
6295
|
let countRight = 0;
|
|
6279
|
-
forEach(ps, (left, right) => {
|
|
6296
|
+
forEach$1(ps, (left, right) => {
|
|
6280
6297
|
countLeft += left;
|
|
6281
6298
|
countRight += right;
|
|
6282
6299
|
});
|
|
6283
6300
|
assert(countLeft === 9);
|
|
6284
6301
|
assert(countRight === 12);
|
|
6285
|
-
assert(countLeft === map$
|
|
6286
|
-
assert(countRight === map$
|
|
6302
|
+
assert(countLeft === map$2(ps, left => left).reduce(add$1));
|
|
6303
|
+
assert(countRight === map$2(ps, (left, right) => right).reduce(add$1));
|
|
6287
6304
|
};
|
|
6288
6305
|
|
|
6289
6306
|
var pair = /*#__PURE__*/Object.freeze({
|
|
@@ -6295,17 +6312,17 @@
|
|
|
6295
6312
|
* @param {t.TestCase} tc
|
|
6296
6313
|
*/
|
|
6297
6314
|
const testObject = tc => {
|
|
6298
|
-
assert(create$
|
|
6315
|
+
assert(create$4().constructor === undefined, 'object.create creates an empty object without constructor');
|
|
6299
6316
|
describe('object.equalFlat');
|
|
6300
|
-
assert(equalFlat
|
|
6301
|
-
assert(equalFlat
|
|
6302
|
-
assert(equalFlat
|
|
6303
|
-
assert(!equalFlat
|
|
6304
|
-
assert(equalFlat
|
|
6305
|
-
assert(!equalFlat
|
|
6317
|
+
assert(equalFlat({}, {}), 'comparing equal objects');
|
|
6318
|
+
assert(equalFlat({ x: 1 }, { x: 1 }), 'comparing equal objects');
|
|
6319
|
+
assert(equalFlat({ x: 'dtrn' }, { x: 'dtrn' }), 'comparing equal objects');
|
|
6320
|
+
assert(!equalFlat({ x: {} }, { x: {} }), 'flatEqual does not dive deep');
|
|
6321
|
+
assert(equalFlat({ x: undefined }, { x: undefined }), 'flatEqual handles undefined');
|
|
6322
|
+
assert(!equalFlat({ x: undefined }, { y: {} }), 'flatEqual handles undefined');
|
|
6306
6323
|
describe('object.every');
|
|
6307
|
-
assert(every
|
|
6308
|
-
assert(!every
|
|
6324
|
+
assert(every({ a: 1, b: 3 }, (v, k) => (v % 2) === 1 && k !== 'c'));
|
|
6325
|
+
assert(!every({ a: 1, b: 3, c: 5 }, (v, k) => (v % 2) === 1 && k !== 'c'));
|
|
6309
6326
|
describe('object.some');
|
|
6310
6327
|
assert(some({ a: 1, b: 3 }, (v, k) => v === 3 && k === 'b'));
|
|
6311
6328
|
assert(!some({ a: 1, b: 5 }, (v, k) => v === 3));
|
|
@@ -6313,13 +6330,13 @@
|
|
|
6313
6330
|
assert(!some({ a: 1, b: 5 }, (v, k) => false));
|
|
6314
6331
|
describe('object.forEach');
|
|
6315
6332
|
let forEachSum = 0;
|
|
6316
|
-
forEach
|
|
6333
|
+
forEach({ x: 1, y: 3 }, (v, k) => { forEachSum += v; });
|
|
6317
6334
|
assert(forEachSum === 4);
|
|
6318
6335
|
describe('object.map');
|
|
6319
|
-
assert(map$
|
|
6336
|
+
assert(map$1({ x: 1, z: 5 }, (v, k) => v).reduce(add$1) === 6);
|
|
6320
6337
|
describe('object.length');
|
|
6321
|
-
assert(length({}) === 0);
|
|
6322
|
-
assert(length({ x: 1 }) === 1);
|
|
6338
|
+
assert(length$1({}) === 0);
|
|
6339
|
+
assert(length$1({ x: 1 }) === 1);
|
|
6323
6340
|
};
|
|
6324
6341
|
|
|
6325
6342
|
var object = /*#__PURE__*/Object.freeze({
|
|
@@ -6336,7 +6353,7 @@
|
|
|
6336
6353
|
assert(abs(Number.MIN_SAFE_INTEGER) === Number.MAX_SAFE_INTEGER);
|
|
6337
6354
|
assert(abs(Number.MAX_SAFE_INTEGER) === Number.MAX_SAFE_INTEGER);
|
|
6338
6355
|
describe('math.add');
|
|
6339
|
-
assert([1, 2, 3, 4, 5].reduce(add) === 15);
|
|
6356
|
+
assert([1, 2, 3, 4, 5].reduce(add$1) === 15);
|
|
6340
6357
|
describe('math.ceil');
|
|
6341
6358
|
assert(ceil(1.5) === 2);
|
|
6342
6359
|
assert(ceil(-1.5) === -1);
|
|
@@ -6344,9 +6361,9 @@
|
|
|
6344
6361
|
assert(floor(1.5) === 1);
|
|
6345
6362
|
assert(floor(-1.5) === -2);
|
|
6346
6363
|
describe('math.isNaN');
|
|
6347
|
-
assert(isNaN(NaN));
|
|
6364
|
+
assert(isNaN$1(NaN));
|
|
6348
6365
|
// @ts-ignore
|
|
6349
|
-
assert(!isNaN(null));
|
|
6366
|
+
assert(!isNaN$1(null));
|
|
6350
6367
|
describe('math.max');
|
|
6351
6368
|
assert([1, 3, 65, 1, 314, 25, 3475, 2, 1].reduce(max) === 3475);
|
|
6352
6369
|
describe('math.min');
|
|
@@ -6366,11 +6383,11 @@
|
|
|
6366
6383
|
*/
|
|
6367
6384
|
const testNumber = tc => {
|
|
6368
6385
|
describe('isNaN');
|
|
6369
|
-
assert(isNaN
|
|
6370
|
-
assert(!isNaN
|
|
6386
|
+
assert(isNaN(NaN));
|
|
6387
|
+
assert(!isNaN(1 / 0));
|
|
6371
6388
|
// @ts-ignore
|
|
6372
|
-
assert(isNaN
|
|
6373
|
-
assert(!isNaN
|
|
6389
|
+
assert(isNaN('a' / 0));
|
|
6390
|
+
assert(!isNaN(0));
|
|
6374
6391
|
describe('isInteger');
|
|
6375
6392
|
assert(!isInteger(1 / 0));
|
|
6376
6393
|
assert(!isInteger(NaN));
|
|
@@ -6708,7 +6725,7 @@
|
|
|
6708
6725
|
* @return {string}
|
|
6709
6726
|
*/
|
|
6710
6727
|
const encodeQueryParams = params =>
|
|
6711
|
-
map$
|
|
6728
|
+
map$1(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&');
|
|
6712
6729
|
|
|
6713
6730
|
/**
|
|
6714
6731
|
* @param {Object<string,any>} params
|
|
@@ -6851,6 +6868,27 @@
|
|
|
6851
6868
|
testDeepEquality: testDeepEquality
|
|
6852
6869
|
});
|
|
6853
6870
|
|
|
6871
|
+
/**
|
|
6872
|
+
* @param {t.TestCase} tc
|
|
6873
|
+
*/
|
|
6874
|
+
const testStorageModule = tc => {
|
|
6875
|
+
const s = varStorage;
|
|
6876
|
+
/**
|
|
6877
|
+
* @type {any}
|
|
6878
|
+
*/
|
|
6879
|
+
let lastEvent = null;
|
|
6880
|
+
onChange(event => {
|
|
6881
|
+
lastEvent = event;
|
|
6882
|
+
});
|
|
6883
|
+
s.setItem('key', 'value');
|
|
6884
|
+
assert(lastEvent === null);
|
|
6885
|
+
};
|
|
6886
|
+
|
|
6887
|
+
var storage = /*#__PURE__*/Object.freeze({
|
|
6888
|
+
__proto__: null,
|
|
6889
|
+
testStorageModule: testStorageModule
|
|
6890
|
+
});
|
|
6891
|
+
|
|
6854
6892
|
/* istanbul ignore if */
|
|
6855
6893
|
if (isBrowser) {
|
|
6856
6894
|
createVConsole(document.body);
|
|
@@ -6866,11 +6904,11 @@
|
|
|
6866
6904
|
indexeddb,
|
|
6867
6905
|
prng,
|
|
6868
6906
|
statistics,
|
|
6869
|
-
binary
|
|
6907
|
+
binary,
|
|
6870
6908
|
random,
|
|
6871
6909
|
promise,
|
|
6872
|
-
queue
|
|
6873
|
-
map
|
|
6910
|
+
queue,
|
|
6911
|
+
map,
|
|
6874
6912
|
eventloop,
|
|
6875
6913
|
time,
|
|
6876
6914
|
pair,
|
|
@@ -6881,7 +6919,8 @@
|
|
|
6881
6919
|
sort,
|
|
6882
6920
|
url,
|
|
6883
6921
|
metric,
|
|
6884
|
-
func
|
|
6922
|
+
func,
|
|
6923
|
+
storage
|
|
6885
6924
|
}).then(success => {
|
|
6886
6925
|
/* istanbul ignore next */
|
|
6887
6926
|
if (isNode) {
|
|
@@ -6889,5 +6928,5 @@
|
|
|
6889
6928
|
}
|
|
6890
6929
|
});
|
|
6891
6930
|
|
|
6892
|
-
}()
|
|
6931
|
+
})();
|
|
6893
6932
|
//# sourceMappingURL=test.js.map
|