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.
Files changed (117) hide show
  1. package/README.md +84 -76
  2. package/bin/gendocs.js +1 -1
  3. package/broadcastchannel.js +1 -1
  4. package/component.d.ts +4 -1
  5. package/component.d.ts.map +1 -1
  6. package/component.js +4 -1
  7. package/decoding.d.ts +0 -12
  8. package/decoding.d.ts.map +1 -1
  9. package/decoding.js +8 -8
  10. package/diff.d.ts.map +1 -1
  11. package/dist/{broadcastchannel-cb74c2ae.cjs → broadcastchannel-044f32d2.cjs} +3 -3
  12. package/dist/broadcastchannel-044f32d2.cjs.map +1 -0
  13. package/dist/broadcastchannel.cjs +4 -4
  14. package/dist/{buffer-097552c3.cjs → buffer-49880125.cjs} +16 -15
  15. package/dist/buffer-49880125.cjs.map +1 -0
  16. package/dist/buffer.cjs +3 -3
  17. package/dist/component.cjs +5 -2
  18. package/dist/component.cjs.map +1 -1
  19. package/dist/component.d.ts +4 -1
  20. package/dist/component.d.ts.map +1 -1
  21. package/dist/decoding.cjs +3 -3
  22. package/dist/decoding.d.ts +0 -12
  23. package/dist/decoding.d.ts.map +1 -1
  24. package/dist/diff.d.ts.map +1 -1
  25. package/dist/encoding.cjs +3 -3
  26. package/dist/encoding.d.ts.map +1 -1
  27. package/dist/{environment-bf1f625d.cjs → environment-7e2ffaea.cjs} +1 -1
  28. package/dist/{environment-bf1f625d.cjs.map → environment-7e2ffaea.cjs.map} +1 -1
  29. package/dist/environment.cjs +1 -1
  30. package/dist/{error-55a9a8c8.cjs → error-873c9cbf.cjs} +4 -4
  31. package/dist/error-873c9cbf.cjs.map +1 -0
  32. package/dist/error.cjs +1 -1
  33. package/dist/error.d.ts.map +1 -1
  34. package/dist/index.cjs +9 -9
  35. package/dist/{indexeddb-44227700.cjs → indexeddb-5b4b0e13.cjs} +27 -25
  36. package/dist/indexeddb-5b4b0e13.cjs.map +1 -0
  37. package/dist/indexeddb.cjs +3 -3
  38. package/dist/indexeddb.d.ts +2 -2
  39. package/dist/indexeddb.d.ts.map +1 -1
  40. package/dist/isomorphic.cjs +2 -6
  41. package/dist/isomorphic.cjs.map +1 -1
  42. package/dist/{logging-4941d274.cjs → logging-7cc36806.cjs} +2 -2
  43. package/dist/{logging-4941d274.cjs.map → logging-7cc36806.cjs.map} +1 -1
  44. package/dist/logging.cjs +2 -2
  45. package/dist/{number-24f1eabe.cjs → number-e62129bc.cjs} +5 -2
  46. package/dist/number-e62129bc.cjs.map +1 -0
  47. package/dist/number.cjs +2 -1
  48. package/dist/number.cjs.map +1 -1
  49. package/dist/number.d.ts +1 -0
  50. package/dist/number.d.ts.map +1 -1
  51. package/dist/observable.d.ts.map +1 -1
  52. package/dist/pair.d.ts.map +1 -1
  53. package/dist/{prng-70808343.cjs → prng-97174619.cjs} +2 -2
  54. package/dist/{prng-70808343.cjs.map → prng-97174619.cjs.map} +1 -1
  55. package/dist/prng.cjs +4 -4
  56. package/dist/{promise-f0a086b2.cjs → promise-1a9fe712.cjs} +10 -1
  57. package/dist/{promise-f0a086b2.cjs.map → promise-1a9fe712.cjs.map} +1 -1
  58. package/dist/promise.cjs +2 -1
  59. package/dist/promise.cjs.map +1 -1
  60. package/dist/promise.d.ts +1 -0
  61. package/dist/promise.d.ts.map +1 -1
  62. package/dist/storage.cjs +16 -4
  63. package/dist/storage.cjs.map +1 -1
  64. package/dist/storage.d.ts +5 -0
  65. package/dist/storage.d.ts.map +1 -1
  66. package/dist/storage.test.d.ts +3 -0
  67. package/dist/storage.test.d.ts.map +1 -0
  68. package/dist/string.cjs +1 -3
  69. package/dist/string.cjs.map +1 -1
  70. package/dist/test.cjs +264 -225
  71. package/dist/test.cjs.map +1 -1
  72. package/dist/test.js +266 -227
  73. package/dist/test.js.map +1 -1
  74. package/dist/testing.cjs +15 -12
  75. package/dist/testing.cjs.map +1 -1
  76. package/dist/testing.d.ts +1 -1
  77. package/dist/testing.d.ts.map +1 -1
  78. package/dist/testing.test.d.ts +1 -1
  79. package/dist/tree.d.ts +1 -1
  80. package/dist/tree.d.ts.map +1 -1
  81. package/dist/websocket.d.ts +1 -1
  82. package/dist/websocket.d.ts.map +1 -1
  83. package/encoding.d.ts.map +1 -1
  84. package/encoding.js +5 -4
  85. package/error.d.ts.map +1 -1
  86. package/error.js +3 -3
  87. package/indexeddb.d.ts +2 -2
  88. package/indexeddb.d.ts.map +1 -1
  89. package/indexeddb.js +25 -23
  90. package/number.d.ts +1 -0
  91. package/number.d.ts.map +1 -1
  92. package/number.js +1 -0
  93. package/observable.d.ts.map +1 -1
  94. package/package.json +11 -10
  95. package/pair.d.ts.map +1 -1
  96. package/promise.d.ts +1 -0
  97. package/promise.d.ts.map +1 -1
  98. package/promise.js +7 -0
  99. package/storage.d.ts +5 -0
  100. package/storage.d.ts.map +1 -1
  101. package/storage.js +15 -4
  102. package/storage.test.d.ts +3 -0
  103. package/storage.test.d.ts.map +1 -0
  104. package/test.js +3 -1
  105. package/testing.d.ts +1 -1
  106. package/testing.d.ts.map +1 -1
  107. package/testing.js +9 -6
  108. package/testing.test.d.ts +1 -1
  109. package/tree.d.ts +1 -1
  110. package/tree.d.ts.map +1 -1
  111. package/websocket.d.ts +1 -1
  112. package/websocket.d.ts.map +1 -1
  113. package/dist/broadcastchannel-cb74c2ae.cjs.map +0 -1
  114. package/dist/buffer-097552c3.cjs.map +0 -1
  115. package/dist/error-55a9a8c8.cjs.map +0 -1
  116. package/dist/indexeddb-44227700.cjs.map +0 -1
  117. package/dist/number-24f1eabe.cjs.map +0 -1
package/dist/test.cjs CHANGED
@@ -16,7 +16,7 @@ var isomorphic_js = require('isomorphic.js');
16
16
  *
17
17
  * @function
18
18
  */
19
- const create = () => new Map();
19
+ const create$7 = () => new Map();
20
20
 
21
21
  /**
22
22
  * Copy a Map object into a fresh Map object.
@@ -27,7 +27,7 @@ const create = () => new Map();
27
27
  * @return {Map<X,Y>}
28
28
  */
29
29
  const copy = m => {
30
- const r = create();
30
+ const r = create$7();
31
31
  m.forEach((v, k) => { r.set(k, v); });
32
32
  return r
33
33
  };
@@ -66,7 +66,7 @@ const setIfUndefined = (map, key, createT) => {
66
66
  * @param {function(V,K):R} f
67
67
  * @return {Array<R>}
68
68
  */
69
- const map = (m, f) => {
69
+ const map$3 = (m, f) => {
70
70
  const res = [];
71
71
  for (const [key, value] of m) {
72
72
  res.push(f(value, key));
@@ -203,7 +203,7 @@ const decodeUtf8 = utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill;
203
203
  /* istanbul ignore next */
204
204
  const undefinedToNull = v => v === undefined ? null : v;
205
205
 
206
- /* global localStorage */
206
+ /* global localStorage, addEventListener */
207
207
 
208
208
  /**
209
209
  * Isomorphic variable storage.
@@ -221,10 +221,10 @@ class VarStoragePolyfill {
221
221
 
222
222
  /**
223
223
  * @param {string} key
224
- * @param {any} value
224
+ * @param {any} newValue
225
225
  */
226
- setItem (key, value) {
227
- this.map.set(key, value);
226
+ setItem (key, newValue) {
227
+ this.map.set(key, newValue);
228
228
  }
229
229
 
230
230
  /**
@@ -240,12 +240,14 @@ class VarStoragePolyfill {
240
240
  * @type {any}
241
241
  */
242
242
  let _localStorage = new VarStoragePolyfill();
243
+ let usePolyfill = true;
243
244
 
244
245
  try {
245
246
  // if the same-origin rule is violated, accessing localStorage might thrown an error
246
247
  /* istanbul ignore next */
247
248
  if (typeof localStorage !== 'undefined') {
248
249
  _localStorage = localStorage;
250
+ usePolyfill = false;
249
251
  }
250
252
  } catch (e) { }
251
253
 
@@ -255,6 +257,15 @@ try {
255
257
  */
256
258
  const varStorage = _localStorage;
257
259
 
260
+ /* istanbul ignore next */
261
+ /**
262
+ * A polyfill for `addEventListener('storage', event => {..})` that does nothing if the polyfill is being used.
263
+ *
264
+ * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler
265
+ * @function
266
+ */
267
+ const onChange = eventHandler => usePolyfill || addEventListener('storage', /** @type {any} */ (eventHandler));
268
+
258
269
  /**
259
270
  * Isomorphic module to work access the environment (query params, env variables).
260
271
  *
@@ -278,7 +289,7 @@ let params;
278
289
  const computeParams = () => {
279
290
  if (params === undefined) {
280
291
  if (isNode) {
281
- params = create();
292
+ params = create$7();
282
293
  const pargs = process.argv;
283
294
  let currParamName = null;
284
295
  /* istanbul ignore next */
@@ -301,7 +312,7 @@ const computeParams = () => {
301
312
  }
302
313
  // in ReactNative for example this would not be true (unless connected to the Remote Debugger)
303
314
  } else if (typeof location === 'object') {
304
- params = create()
315
+ params = create$7()
305
316
  // eslint-disable-next-line no-undef
306
317
  ;(location.search || '?').slice(1).split('&').forEach(kv => {
307
318
  if (kv.length !== 0) {
@@ -311,7 +322,7 @@ const computeParams = () => {
311
322
  }
312
323
  });
313
324
  } else {
314
- params = create();
325
+ params = create$7();
315
326
  }
316
327
  }
317
328
  return params
@@ -361,7 +372,7 @@ const production = hasConf('production');
361
372
  *
362
373
  * @return {Symbol}
363
374
  */
364
- const create$1 = Symbol;
375
+ const create$6 = Symbol;
365
376
 
366
377
  /**
367
378
  * Working with value pairs.
@@ -389,7 +400,7 @@ class Pair {
389
400
  * @param {R} right
390
401
  * @return {Pair<L,R>}
391
402
  */
392
- const create$2 = (left, right) => new Pair(left, right);
403
+ const create$5 = (left, right) => new Pair(left, right);
393
404
 
394
405
  /**
395
406
  * @template L,R
@@ -404,7 +415,7 @@ const createReversed = (right, left) => new Pair(left, right);
404
415
  * @param {Array<Pair<L,R>>} arr
405
416
  * @param {function(L, R):any} f
406
417
  */
407
- const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right));
418
+ const forEach$1 = (arr, f) => arr.forEach(p => f(p.left, p.right));
408
419
 
409
420
  /**
410
421
  * @template L,R,X
@@ -412,7 +423,7 @@ const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right));
412
423
  * @param {function(L, R):X} f
413
424
  * @return {Array<X>}
414
425
  */
415
- const map$1 = (arr, f) => arr.map(p => f(p.left, p.right));
426
+ const map$2 = (arr, f) => arr.map(p => f(p.left, p.right));
416
427
 
417
428
  /* eslint-env browser */
418
429
 
@@ -452,7 +463,7 @@ const createTextNode = text => doc.createTextNode(text);
452
463
  */
453
464
  /* istanbul ignore next */
454
465
  const setAttributes = (el, attrs) => {
455
- forEach(attrs, (key, value) => {
466
+ forEach$1(attrs, (key, value) => {
456
467
  if (value === false) {
457
468
  el.removeAttribute(key);
458
469
  } else if (value === true) {
@@ -531,7 +542,7 @@ const text = createTextNode;
531
542
  * @return {string}
532
543
  */
533
544
  /* istanbul ignore next */
534
- const mapToStyleString = m => map(m, (value, key) => `${key}:${value};`).join('');
545
+ const mapToStyleString = m => map$3(m, (value, key) => `${key}:${value};`).join('');
535
546
 
536
547
  /**
537
548
  * @param {Node} parent
@@ -541,6 +552,14 @@ const mapToStyleString = m => map(m, (value, key) => `${key}:${value};`).join(''
541
552
  /* istanbul ignore next */
542
553
  const appendChild = (parent, child) => parent.appendChild(child);
543
554
 
555
+ doc.ELEMENT_NODE;
556
+ doc.TEXT_NODE;
557
+ doc.CDATA_SECTION_NODE;
558
+ doc.COMMENT_NODE;
559
+ doc.DOCUMENT_NODE;
560
+ doc.DOCUMENT_TYPE_NODE;
561
+ doc.DOCUMENT_FRAGMENT_NODE;
562
+
544
563
  /**
545
564
  * JSON utility functions.
546
565
  *
@@ -566,21 +585,21 @@ const stringify = JSON.stringify;
566
585
  /**
567
586
  * @type {Array<function>}
568
587
  */
569
- let queue = [];
588
+ let queue$1 = [];
570
589
 
571
590
  const _runQueue = () => {
572
- for (let i = 0; i < queue.length; i++) {
573
- queue[i]();
591
+ for (let i = 0; i < queue$1.length; i++) {
592
+ queue$1[i]();
574
593
  }
575
- queue = [];
594
+ queue$1 = [];
576
595
  };
577
596
 
578
597
  /**
579
598
  * @param {function():void} f
580
599
  */
581
- const enqueue = f => {
582
- queue.push(f);
583
- if (queue.length === 1) {
600
+ const enqueue$1 = f => {
601
+ queue$1.push(f);
602
+ if (queue$1.length === 1) {
584
603
  setTimeout(_runQueue, 0);
585
604
  }
586
605
  };
@@ -667,7 +686,7 @@ const log10 = Math.log10;
667
686
  * @param {number} b
668
687
  * @return {number} The sum of a and b
669
688
  */
670
- const add = (a, b) => a + b;
689
+ const add$1 = (a, b) => a + b;
671
690
 
672
691
  /**
673
692
  * @function
@@ -685,7 +704,7 @@ const min = (a, b) => a < b ? a : b;
685
704
  */
686
705
  const max = (a, b) => a > b ? a : b;
687
706
 
688
- const isNaN = Number.isNaN;
707
+ const isNaN$1 = Number.isNaN;
689
708
  /**
690
709
  * Base 10 exponential function. Returns the value of 10 raised to the power of pow.
691
710
  *
@@ -818,7 +837,7 @@ const appendTo = (dest, src) => {
818
837
  * @param {function(ITEM, number, Array<ITEM>):boolean} f
819
838
  * @return {boolean}
820
839
  */
821
- const every = (arr, f) => arr.every(f);
840
+ const every$1 = (arr, f) => arr.every(f);
822
841
 
823
842
  /**
824
843
  * @template ELEM
@@ -827,7 +846,7 @@ const every = (arr, f) => arr.every(f);
827
846
  * @param {Array<ELEM>} b
828
847
  * @return {boolean}
829
848
  */
830
- const equalFlat = (a, b) => a.length === b.length && every(a, (item, index) => item === b[index]);
849
+ const equalFlat$1 = (a, b) => a.length === b.length && every$1(a, (item, index) => item === b[index]);
831
850
 
832
851
  /**
833
852
  * @template ELEM
@@ -845,7 +864,7 @@ const flatten = arr => arr.reduce((acc, val) => acc.concat(val), []);
845
864
  /**
846
865
  * @return {Object<string,any>} obj
847
866
  */
848
- const create$3 = () => Object.create(null);
867
+ const create$4 = () => Object.create(null);
849
868
 
850
869
  /**
851
870
  * Object.assign
@@ -861,7 +880,7 @@ const keys = Object.keys;
861
880
  * @param {Object<string,any>} obj
862
881
  * @param {function(any,string):any} f
863
882
  */
864
- const forEach$1 = (obj, f) => {
883
+ const forEach = (obj, f) => {
865
884
  for (const key in obj) {
866
885
  f(obj[key], key);
867
886
  }
@@ -873,7 +892,7 @@ const forEach$1 = (obj, f) => {
873
892
  * @param {function(any,string):R} f
874
893
  * @return {Array<R>}
875
894
  */
876
- const map$2 = (obj, f) => {
895
+ const map$1 = (obj, f) => {
877
896
  const results = [];
878
897
  for (const key in obj) {
879
898
  results.push(f(obj[key], key));
@@ -885,7 +904,7 @@ const map$2 = (obj, f) => {
885
904
  * @param {Object<string,any>} obj
886
905
  * @return {number}
887
906
  */
888
- const length = obj => keys(obj).length;
907
+ const length$1 = obj => keys(obj).length;
889
908
 
890
909
  /**
891
910
  * @param {Object<string,any>} obj
@@ -906,7 +925,7 @@ const some = (obj, f) => {
906
925
  * @param {function(any,string):boolean} f
907
926
  * @return {boolean}
908
927
  */
909
- const every$1 = (obj, f) => {
928
+ const every = (obj, f) => {
910
929
  for (const key in obj) {
911
930
  if (!f(obj[key], key)) {
912
931
  return false
@@ -929,7 +948,7 @@ const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key)
929
948
  * @param {Object<string,any>} b
930
949
  * @return {boolean}
931
950
  */
932
- const equalFlat$1 = (a, b) => a === b || (length(a) === length(b) && every$1(a, (val, key) => (val !== undefined || hasProperty(b, key)) && b[key] === val));
951
+ const equalFlat = (a, b) => a === b || (length$1(a) === length$1(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && b[key] === val));
933
952
 
934
953
  /**
935
954
  * Common functions and function call helpers.
@@ -953,7 +972,7 @@ const equalityStrict = (a, b) => a === b;
953
972
  * @param {Array<T>|object} b
954
973
  * @return {boolean}
955
974
  */
956
- 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$1(a, b))));
975
+ 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))));
957
976
 
958
977
  /**
959
978
  * @param {any} a
@@ -1009,7 +1028,7 @@ const equalityDeep = (a, b) => {
1009
1028
  break
1010
1029
  }
1011
1030
  case Object:
1012
- if (length(a) !== length(b)) {
1031
+ if (length$1(a) !== length$1(b)) {
1013
1032
  return false
1014
1033
  }
1015
1034
  for (const key in a) {
@@ -1040,29 +1059,29 @@ const equalityDeep = (a, b) => {
1040
1059
  * @module logging
1041
1060
  */
1042
1061
 
1043
- const BOLD = create$1();
1044
- const UNBOLD = create$1();
1045
- const BLUE = create$1();
1046
- const GREY = create$1();
1047
- const GREEN = create$1();
1048
- const RED = create$1();
1049
- const PURPLE = create$1();
1050
- const ORANGE = create$1();
1051
- const UNCOLOR = create$1();
1062
+ const BOLD = create$6();
1063
+ const UNBOLD = create$6();
1064
+ const BLUE = create$6();
1065
+ const GREY = create$6();
1066
+ const GREEN = create$6();
1067
+ const RED = create$6();
1068
+ const PURPLE = create$6();
1069
+ const ORANGE = create$6();
1070
+ const UNCOLOR = create$6();
1052
1071
 
1053
1072
  /**
1054
1073
  * @type {Object<Symbol,pair.Pair<string,string>>}
1055
1074
  */
1056
1075
  const _browserStyleMap = {
1057
- [BOLD]: create$2('font-weight', 'bold'),
1058
- [UNBOLD]: create$2('font-weight', 'normal'),
1059
- [BLUE]: create$2('color', 'blue'),
1060
- [GREEN]: create$2('color', 'green'),
1061
- [GREY]: create$2('color', 'grey'),
1062
- [RED]: create$2('color', 'red'),
1063
- [PURPLE]: create$2('color', 'purple'),
1064
- [ORANGE]: create$2('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
1065
- [UNCOLOR]: create$2('color', 'black')
1076
+ [BOLD]: create$5('font-weight', 'bold'),
1077
+ [UNBOLD]: create$5('font-weight', 'normal'),
1078
+ [BLUE]: create$5('color', 'blue'),
1079
+ [GREEN]: create$5('color', 'green'),
1080
+ [GREY]: create$5('color', 'grey'),
1081
+ [RED]: create$5('color', 'red'),
1082
+ [PURPLE]: create$5('color', 'purple'),
1083
+ [ORANGE]: create$5('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
1084
+ [UNCOLOR]: create$5('color', 'black')
1066
1085
  };
1067
1086
 
1068
1087
  const _nodeStyleMap = {
@@ -1085,7 +1104,7 @@ const _nodeStyleMap = {
1085
1104
  const computeBrowserLoggingArgs = args => {
1086
1105
  const strBuilder = [];
1087
1106
  const styles = [];
1088
- const currentStyle = create();
1107
+ const currentStyle = create$7();
1089
1108
  /**
1090
1109
  * @type {Array<string|Object|number>}
1091
1110
  */
@@ -1214,7 +1233,7 @@ const printImgBase64 = (base64, height) => printImg(`data:image/gif;base64,${bas
1214
1233
  /**
1215
1234
  * @param {Array<string|Symbol|Object|number>} args
1216
1235
  */
1217
- const group = (...args) => {
1236
+ const group$1 = (...args) => {
1218
1237
  console.group(...computeLoggingArgs(args));
1219
1238
  /* istanbul ignore next */
1220
1239
  vconsoles.forEach(vc => vc.group(args));
@@ -1240,7 +1259,7 @@ const groupEnd = () => {
1240
1259
  * @param {HTMLCanvasElement} canvas
1241
1260
  * @param {number} height
1242
1261
  */
1243
- const printCanvas = (canvas, height) => printImg(canvas.toDataURL(), height);
1262
+ const printCanvas$1 = (canvas, height) => printImg(canvas.toDataURL(), height);
1244
1263
 
1245
1264
  const vconsoles = new Set();
1246
1265
 
@@ -1263,7 +1282,7 @@ const _computeLineSpans = args => {
1263
1282
  } else {
1264
1283
  if (arg.constructor === String || arg.constructor === Number) {
1265
1284
  // @ts-ignore
1266
- const span = element('span', [create$2('style', mapToStyleString(currentStyle))], [text(arg)]);
1285
+ const span = element('span', [create$5('style', mapToStyleString(currentStyle))], [text(arg)]);
1267
1286
  if (span.innerHTML === '') {
1268
1287
  span.innerHTML = '&nbsp;';
1269
1288
  }
@@ -1308,11 +1327,11 @@ class VConsole {
1308
1327
  * @param {boolean} collapsed
1309
1328
  */
1310
1329
  group (args, collapsed = false) {
1311
- enqueue(() => {
1312
- const triangleDown = element('span', [create$2('hidden', collapsed), create$2('style', 'color:grey;font-size:120%;')], [text('▼')]);
1313
- const triangleRight = element('span', [create$2('hidden', !collapsed), create$2('style', 'color:grey;font-size:125%;')], [text('▶')]);
1314
- const content = element('div', [create$2('style', `${lineStyle};padding-left:${this.depth * 10}px`)], [triangleDown, triangleRight, text(' ')].concat(_computeLineSpans(args)));
1315
- const nextContainer = element('div', [create$2('hidden', collapsed)]);
1330
+ enqueue$1(() => {
1331
+ const triangleDown = element('span', [create$5('hidden', collapsed), create$5('style', 'color:grey;font-size:120%;')], [text('▼')]);
1332
+ const triangleRight = element('span', [create$5('hidden', !collapsed), create$5('style', 'color:grey;font-size:125%;')], [text('▶')]);
1333
+ const content = element('div', [create$5('style', `${lineStyle};padding-left:${this.depth * 10}px`)], [triangleDown, triangleRight, text(' ')].concat(_computeLineSpans(args)));
1334
+ const nextContainer = element('div', [create$5('hidden', collapsed)]);
1316
1335
  const nextLine = element('div', [], [content, nextContainer]);
1317
1336
  append(this.ccontainer, [nextLine]);
1318
1337
  this.ccontainer = nextContainer;
@@ -1334,7 +1353,7 @@ class VConsole {
1334
1353
  }
1335
1354
 
1336
1355
  groupEnd () {
1337
- enqueue(() => {
1356
+ enqueue$1(() => {
1338
1357
  if (this.depth > 0) {
1339
1358
  this.depth--;
1340
1359
  // @ts-ignore
@@ -1347,8 +1366,8 @@ class VConsole {
1347
1366
  * @param {Array<string|Symbol|Object|number>} args
1348
1367
  */
1349
1368
  print (args) {
1350
- enqueue(() => {
1351
- append(this.ccontainer, [element('div', [create$2('style', `${lineStyle};padding-left:${this.depth * 10}px`)], _computeLineSpans(args))]);
1369
+ enqueue$1(() => {
1370
+ append(this.ccontainer, [element('div', [create$5('style', `${lineStyle};padding-left:${this.depth * 10}px`)], _computeLineSpans(args))]);
1352
1371
  });
1353
1372
  }
1354
1373
 
@@ -1364,8 +1383,8 @@ class VConsole {
1364
1383
  * @param {number} height
1365
1384
  */
1366
1385
  printImg (url, height) {
1367
- enqueue(() => {
1368
- append(this.ccontainer, [element('img', [create$2('src', url), create$2('height', `${round(height * 1.5)}px`)])]);
1386
+ enqueue$1(() => {
1387
+ append(this.ccontainer, [element('img', [create$5('src', url), create$5('height', `${round(height * 1.5)}px`)])]);
1369
1388
  });
1370
1389
  }
1371
1390
 
@@ -1373,13 +1392,13 @@ class VConsole {
1373
1392
  * @param {Node} node
1374
1393
  */
1375
1394
  printDom (node) {
1376
- enqueue(() => {
1395
+ enqueue$1(() => {
1377
1396
  append(this.ccontainer, [node]);
1378
1397
  });
1379
1398
  }
1380
1399
 
1381
1400
  destroy () {
1382
- enqueue(() => {
1401
+ enqueue$1(() => {
1383
1402
  vconsoles.delete(this);
1384
1403
  });
1385
1404
  }
@@ -1448,12 +1467,6 @@ const simpleDiffString = (a, b) => {
1448
1467
  }
1449
1468
  };
1450
1469
 
1451
- /**
1452
- * @todo Remove in favor of simpleDiffString
1453
- * @deprecated
1454
- */
1455
- const simpleDiff = simpleDiffString;
1456
-
1457
1470
  /**
1458
1471
  * Create a diff between two arrays. This diff implementation is highly
1459
1472
  * efficient, but not very sophisticated.
@@ -1489,12 +1502,12 @@ const simpleDiffArray = (a, b, compare = equalityStrict) => {
1489
1502
  };
1490
1503
 
1491
1504
  /* istanbul ignore next */
1492
- const uint32 = () => new Uint32Array(isomorphic_js.cryptoRandomBuffer(4))[0];
1505
+ const uint32$1 = () => new Uint32Array(isomorphic_js.cryptoRandomBuffer(4))[0];
1493
1506
 
1494
1507
  // @ts-ignore
1495
1508
  const uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11;
1496
1509
  const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c =>
1497
- (c ^ uint32() & 15 >> c / 4).toString(16)
1510
+ (c ^ uint32$1() & 15 >> c / 4).toString(16)
1498
1511
  );
1499
1512
 
1500
1513
  /* eslint-env browser */
@@ -1588,7 +1601,7 @@ const BITS31 = 0x7FFFFFFF;
1588
1601
  */
1589
1602
  const BITS32 = 0xFFFFFFFF;
1590
1603
 
1591
- var binary = /*#__PURE__*/Object.freeze({
1604
+ var binary$1 = /*#__PURE__*/Object.freeze({
1592
1605
  __proto__: null,
1593
1606
  BIT1: BIT1,
1594
1607
  BIT2: BIT2,
@@ -1821,7 +1834,7 @@ const HIGHEST_INT32 = BITS31;
1821
1834
 
1822
1835
  /* istanbul ignore next */
1823
1836
  const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && floor(num) === num);
1824
- const isNaN$1 = Number.isNaN;
1837
+ const isNaN = Number.isNaN;
1825
1838
 
1826
1839
  /**
1827
1840
  * Efficient schema-less binary encoding with support for variable length encoding.
@@ -1878,7 +1891,7 @@ const createEncoder = () => new Encoder();
1878
1891
  * @param {Encoder} encoder
1879
1892
  * @return {number}
1880
1893
  */
1881
- const length$1 = encoder => {
1894
+ const length = encoder => {
1882
1895
  let len = encoder.cpos;
1883
1896
  for (let i = 0; i < encoder.bufs.length; i++) {
1884
1897
  len += encoder.bufs[i].length;
@@ -1894,7 +1907,7 @@ const length$1 = encoder => {
1894
1907
  * @return {Uint8Array} The created ArrayBuffer.
1895
1908
  */
1896
1909
  const toUint8Array = encoder => {
1897
- const uint8arr = new Uint8Array(length$1(encoder));
1910
+ const uint8arr = new Uint8Array(length(encoder));
1898
1911
  let curPos = 0;
1899
1912
  for (let i = 0; i < encoder.bufs.length; i++) {
1900
1913
  const d = encoder.bufs[i];
@@ -2193,19 +2206,19 @@ const writeOnDataView = (encoder, len) => {
2193
2206
  * @param {Encoder} encoder
2194
2207
  * @param {number} num
2195
2208
  */
2196
- const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num);
2209
+ const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false);
2197
2210
 
2198
2211
  /**
2199
2212
  * @param {Encoder} encoder
2200
2213
  * @param {number} num
2201
2214
  */
2202
- const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num);
2215
+ const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false);
2203
2216
 
2204
2217
  /**
2205
2218
  * @param {Encoder} encoder
2206
2219
  * @param {bigint} num
2207
2220
  */
2208
- const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num);
2221
+ const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false);
2209
2222
 
2210
2223
  const floatTestBed = new DataView(new ArrayBuffer(4));
2211
2224
  /**
@@ -2443,6 +2456,7 @@ class RleIntDiffEncoder extends Encoder {
2443
2456
  * @param {UintOptRleEncoder} encoder
2444
2457
  */
2445
2458
  const flushUintOptRleEncoder = encoder => {
2459
+ /* istanbul ignore else */
2446
2460
  if (encoder.count > 0) {
2447
2461
  // flush counter, unless this is the first value (count = 0)
2448
2462
  // case 1: just a single value. set sign to positive
@@ -2783,7 +2797,7 @@ const readUint32BigEndian = decoder => {
2783
2797
  };
2784
2798
 
2785
2799
  /**
2786
- * Look ahead without incrementing position.
2800
+ * Look ahead without incrementing the position
2787
2801
  * to the next byte and read it as unsigned integer.
2788
2802
  *
2789
2803
  * @function
@@ -2793,7 +2807,7 @@ const readUint32BigEndian = decoder => {
2793
2807
  const peekUint8 = decoder => decoder.arr[decoder.pos];
2794
2808
 
2795
2809
  /**
2796
- * Look ahead without incrementing position.
2810
+ * Look ahead without incrementing the position
2797
2811
  * to the next byte and read it as unsigned integer.
2798
2812
  *
2799
2813
  * @function
@@ -2805,7 +2819,7 @@ const peekUint16 = decoder =>
2805
2819
  (decoder.arr[decoder.pos + 1] << 8);
2806
2820
 
2807
2821
  /**
2808
- * Look ahead without incrementing position.
2822
+ * Look ahead without incrementing the position
2809
2823
  * to the next byte and read it as unsigned integer.
2810
2824
  *
2811
2825
  * @function
@@ -2851,7 +2865,7 @@ const readVarUint = decoder => {
2851
2865
  * 1/8th of the storage is used as encoding overhead.
2852
2866
  * * numbers < 2^7 is stored in one bytlength
2853
2867
  * * numbers < 2^14 is stored in two bylength
2854
- * @todo This should probably create the inverse ~num if unmber is negative - but this would be a breaking change.
2868
+ * @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change.
2855
2869
  *
2856
2870
  * @function
2857
2871
  * @param {Decoder} decoder
@@ -2974,17 +2988,17 @@ const readFromDataView = (decoder, len) => {
2974
2988
  /**
2975
2989
  * @param {Decoder} decoder
2976
2990
  */
2977
- const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0);
2991
+ const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0, false);
2978
2992
 
2979
2993
  /**
2980
2994
  * @param {Decoder} decoder
2981
2995
  */
2982
- const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0);
2996
+ const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0, false);
2983
2997
 
2984
2998
  /**
2985
2999
  * @param {Decoder} decoder
2986
3000
  */
2987
- const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0);
3001
+ const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0, false);
2988
3002
 
2989
3003
  /**
2990
3004
  * @type {Array<function(Decoder):any>}
@@ -3348,7 +3362,7 @@ const DefaultPRNG = Xoroshiro128plus;
3348
3362
  * @param {number} seed A positive 32bit integer. Do not use negative numbers.
3349
3363
  * @return {PRNG}
3350
3364
  */
3351
- const create$4 = seed => new DefaultPRNG(seed);
3365
+ const create$3 = seed => new DefaultPRNG(seed);
3352
3366
 
3353
3367
  /**
3354
3368
  * Generates a single random bool.
@@ -3396,7 +3410,7 @@ const int32 = (gen, min, max) => floor(gen.next() * (max + 1 - min) + min);
3396
3410
  * @param {Number} max The upper bound of the allowed return values (inclusive).
3397
3411
  * @return {Number} A random integer on [min, max]
3398
3412
  */
3399
- const uint32$1 = (gen, min, max) => int32(gen, min, max) >>> 0;
3413
+ const uint32 = (gen, min, max) => int32(gen, min, max) >>> 0;
3400
3414
 
3401
3415
  /**
3402
3416
  * @deprecated
@@ -3519,7 +3533,7 @@ const median = arr => arr.length === 0 ? NaN : (arr.length % 2 === 1 ? arr[(arr.
3519
3533
  * @param {Array<number>} arr
3520
3534
  * @return {number}
3521
3535
  */
3522
- const average = arr => arr.reduce(add, 0) / arr.length;
3536
+ const average = arr => arr.reduce(add$1, 0) / arr.length;
3523
3537
 
3524
3538
  /**
3525
3539
  * Utility helpers to work with promises.
@@ -3538,7 +3552,7 @@ const average = arr => arr.reduce(add, 0) / arr.length;
3538
3552
  * @param {function(PromiseResolve<T>,function(Error):void):any} f
3539
3553
  * @return {Promise<T>}
3540
3554
  */
3541
- const create$5 = f => /** @type {Promise<T>} */ (new Promise(f));
3555
+ const create$2 = f => /** @type {Promise<T>} */ (new Promise(f));
3542
3556
 
3543
3557
  /**
3544
3558
  * @param {function(function():void,function(Error):void):void} f
@@ -3575,7 +3589,7 @@ const resolve = res => Promise.resolve(res);
3575
3589
  * @param {number} [intervalResolution]
3576
3590
  * @return {Promise<void>}
3577
3591
  */
3578
- const until = (timeout, check, intervalResolution = 10) => create$5((resolve, reject) => {
3592
+ const until = (timeout, check, intervalResolution = 10) => create$2((resolve, reject) => {
3579
3593
  const startTime = getUnixTime();
3580
3594
  const hasTimeout = timeout > 0;
3581
3595
  const untilInterval = () => {
@@ -3597,7 +3611,7 @@ const until = (timeout, check, intervalResolution = 10) => create$5((resolve, re
3597
3611
  * @param {number} timeout
3598
3612
  * @return {Promise<undefined>}
3599
3613
  */
3600
- const wait = timeout => create$5((resolve, reject) => setTimeout(resolve, timeout));
3614
+ const wait = timeout => create$2((resolve, reject) => setTimeout(resolve, timeout));
3601
3615
 
3602
3616
  /**
3603
3617
  * Checks if an object is a promise using ducktyping.
@@ -3691,7 +3705,7 @@ class TestCase {
3691
3705
  /* istanbul ignore else */
3692
3706
  if (this._seed === null) {
3693
3707
  /* istanbul ignore next */
3694
- this._seed = envSeed === null ? uint32() : envSeed;
3708
+ this._seed = envSeed === null ? uint32$1() : envSeed;
3695
3709
  }
3696
3710
  return this._seed
3697
3711
  }
@@ -3704,13 +3718,13 @@ class TestCase {
3704
3718
  get prng () {
3705
3719
  /* istanbul ignore else */
3706
3720
  if (this._prng === null) {
3707
- this._prng = create$4(this.seed);
3721
+ this._prng = create$3(this.seed);
3708
3722
  }
3709
3723
  return this._prng
3710
3724
  }
3711
3725
  }
3712
3726
 
3713
- const repititionTime = Number(getParam('--repitition-time', '50'));
3727
+ const repetitionTime = Number(getParam('--repetition-time', '50'));
3714
3728
  /* istanbul ignore next */
3715
3729
  const testFilter = hasParam('--filter') ? getParam('--filter', '') : null;
3716
3730
 
@@ -3740,11 +3754,14 @@ const run = async (moduleName, name, f, i, numberOfTests) => {
3740
3754
  if (testFilter === null) {
3741
3755
  groupCollapsed(...groupArgs);
3742
3756
  } else {
3743
- group(...groupArgs);
3757
+ group$1(...groupArgs);
3744
3758
  }
3745
3759
  const times = [];
3746
3760
  const start = isomorphic_js.performance.now();
3747
3761
  let lastTime = start;
3762
+ /**
3763
+ * @type {any}
3764
+ */
3748
3765
  let err = null;
3749
3766
  isomorphic_js.performance.mark(`${name}-start`);
3750
3767
  do {
@@ -3759,12 +3776,12 @@ const run = async (moduleName, name, f, i, numberOfTests) => {
3759
3776
  const currTime = isomorphic_js.performance.now();
3760
3777
  times.push(currTime - lastTime);
3761
3778
  lastTime = currTime;
3762
- if (repeat && err === null && (lastTime - start) < repititionTime) {
3779
+ if (repeat && err === null && (lastTime - start) < repetitionTime) {
3763
3780
  tc.resetSeed();
3764
3781
  } else {
3765
3782
  break
3766
3783
  }
3767
- } while (err === null && (lastTime - start) < repititionTime)
3784
+ } while (err === null && (lastTime - start) < repetitionTime)
3768
3785
  isomorphic_js.performance.mark(`${name}-end`);
3769
3786
  /* istanbul ignore if */
3770
3787
  if (err !== null && err.constructor !== SkipError) {
@@ -3780,7 +3797,7 @@ const run = async (moduleName, name, f, i, numberOfTests) => {
3780
3797
  ? ` - ${window.location.href}?filter=\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}`
3781
3798
  : `\nrepeat: npm run test -- --filter "\\[${i + 1}/" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`;
3782
3799
  const timeInfo = (repeat && err === null)
3783
- ? ` - ${times.length} repititions in ${humanizeDuration(duration)} (best: ${humanizeDuration(times[0])}, worst: ${humanizeDuration(last(times))}, median: ${humanizeDuration(median(times))}, average: ${humanizeDuration(average(times))})`
3800
+ ? ` - ${times.length} repetitions in ${humanizeDuration(duration)} (best: ${humanizeDuration(times[0])}, worst: ${humanizeDuration(last(times))}, median: ${humanizeDuration(median(times))}, average: ${humanizeDuration(average(times))})`
3784
3801
  : ` in ${humanizeDuration(duration)}`;
3785
3802
  if (err !== null) {
3786
3803
  /* istanbul ignore else */
@@ -3822,7 +3839,7 @@ const describe = (description, info = '') => print(BLUE, description, ' ', GREY,
3822
3839
  */
3823
3840
  const info = info => describe('', info);
3824
3841
 
3825
- const printCanvas$1 = printCanvas;
3842
+ const printCanvas = printCanvas$1;
3826
3843
 
3827
3844
  /**
3828
3845
  * Group outputs in a collapsible category.
@@ -3842,8 +3859,8 @@ const printCanvas$1 = printCanvas;
3842
3859
  * @param {string} description
3843
3860
  * @param {function(void):void} f
3844
3861
  */
3845
- const group$1 = (description, f) => {
3846
- group(BLUE, description);
3862
+ const group = (description, f) => {
3863
+ group$1(BLUE, description);
3847
3864
  try {
3848
3865
  f();
3849
3866
  } finally {
@@ -3870,7 +3887,7 @@ const group$1 = (description, f) => {
3870
3887
  * @param {function(void):Promise<any>} f
3871
3888
  */
3872
3889
  const groupAsync = async (description, f) => {
3873
- group(BLUE, description);
3890
+ group$1(BLUE, description);
3874
3891
  try {
3875
3892
  await f();
3876
3893
  } finally {
@@ -3965,7 +3982,7 @@ const compareArrays = (as, bs, m = 'Arrays match') => {
3965
3982
  */
3966
3983
  const compareStrings = (a, b, m = 'Strings match') => {
3967
3984
  if (a !== b) {
3968
- const diff = simpleDiff(a, b);
3985
+ const diff = simpleDiffString(a, b);
3969
3986
  print(GREY, a.slice(0, diff.index), RED, a.slice(diff.index, diff.remove), GREEN, diff.insert, GREY, a.slice(diff.index + diff.remove));
3970
3987
  fail(m);
3971
3988
  }
@@ -3978,7 +3995,7 @@ const compareStrings = (a, b, m = 'Strings match') => {
3978
3995
  * @param {string} [m]
3979
3996
  * @throws {TestError} Throws if test fails
3980
3997
  */
3981
- const compareObjects = (a, b, m = 'Objects match') => { equalFlat$1(a, b) || fail(m); };
3998
+ const compareObjects = (a, b, m = 'Objects match') => { equalFlat(a, b) || fail(m); };
3982
3999
 
3983
4000
  /**
3984
4001
  * @param {any} constructor
@@ -4062,10 +4079,10 @@ const _compare = (a, b, path, message, customCompare) => {
4062
4079
  break
4063
4080
  }
4064
4081
  case Object:
4065
- if (length(a) !== length(b)) {
4082
+ if (length$1(a) !== length$1(b)) {
4066
4083
  _failMessage(message, 'Objects have a different number of attributes', path);
4067
4084
  }
4068
- forEach$1(a, (value, key) => {
4085
+ forEach(a, (value, key) => {
4069
4086
  if (!hasProperty(b, key)) {
4070
4087
  _failMessage(message, `Property ${path} does not exist on second argument`, path);
4071
4088
  }
@@ -4128,7 +4145,7 @@ const fails = f => {
4128
4145
  * @param {Object<string, Object<string, function(TestCase):void|Promise<any>>>} tests
4129
4146
  */
4130
4147
  const runTests = async tests => {
4131
- const numberOfTests = map$2(tests, mod => map$2(mod, f => /* istanbul ignore next */ f ? 1 : 0).reduce(add, 0)).reduce(add, 0);
4148
+ const numberOfTests = map$1(tests, mod => map$1(mod, f => /* istanbul ignore next */ f ? 1 : 0).reduce(add$1, 0)).reduce(add$1, 0);
4132
4149
  let successfulTests = 0;
4133
4150
  let testnumber = 0;
4134
4151
  const start = isomorphic_js.performance.now();
@@ -4317,8 +4334,8 @@ let genAnyLookupTable = [
4317
4334
  gen => false, // TYPE 120
4318
4335
  gen => utf16String(gen), // TYPE 119
4319
4336
  (gen, depth, toJsonCompatible) => ({ val: genAny(gen, depth + 1, toJsonCompatible) }), // TYPE 118
4320
- (gen, depth, toJsonCompatible) => Array.from({ length: uint32$1(gen, 0, 20 - depth) }).map(() => genAny(gen, depth + 1, toJsonCompatible)), // TYPE 117
4321
- gen => uint8Array(gen, uint32$1(gen, 0, 50)) // TYPE 116
4337
+ (gen, depth, toJsonCompatible) => Array.from({ length: uint32(gen, 0, 20 - depth) }).map(() => genAny(gen, depth + 1, toJsonCompatible)), // TYPE 117
4338
+ gen => uint8Array(gen, uint32(gen, 0, 50)) // TYPE 116
4322
4339
  ];
4323
4340
 
4324
4341
  const genAnyLookupTableJsonCompatible = genAnyLookupTable.slice(1);
@@ -4387,7 +4404,7 @@ function test (testname, write, read, val, doLog = true) {
4387
4404
  const reader = createDecoder(toUint8Array(encoder));
4388
4405
  const result = read(reader);
4389
4406
  const utf8ByteLength$1 = utf8ByteLength(val + '');
4390
- const binaryByteLength = length$1(encoder);
4407
+ const binaryByteLength = length(encoder);
4391
4408
  if (doLog) {
4392
4409
  describe(testname, ` utf8 encode: ${utf8ByteLength$1} bytes / binary encode: ${binaryByteLength} bytes`);
4393
4410
  }
@@ -4553,7 +4570,7 @@ const testRepeatVarUintEncoding = tc => {
4553
4570
  * @param {t.TestCase} tc
4554
4571
  */
4555
4572
  const testRepeatVarIntEncoding = tc => {
4556
- const n = uint32$1(tc.prng, 0, BITS32);
4573
+ const n = uint32(tc.prng, 0, BITS32);
4557
4574
  test(`varInt of ${n}`, writeVarInt, readVarInt, n, false);
4558
4575
  };
4559
4576
 
@@ -4577,7 +4594,7 @@ const testRepeatPeekVarUintEncoding = tc => {
4577
4594
  * @param {t.TestCase} tc
4578
4595
  */
4579
4596
  const testRepeatPeekVarIntEncoding = tc => {
4580
- const n = uint32$1(tc.prng, 0, BITS32);
4597
+ const n = uint32(tc.prng, 0, BITS32);
4581
4598
  test(`varInt of ${n}`, writeVarInt, peekVarInt, n, false);
4582
4599
  };
4583
4600
 
@@ -4668,12 +4685,12 @@ const strictComparison = (a, b) => a === b;
4668
4685
  */
4669
4686
  const encodingPairs = [
4670
4687
  { name: 'uint8Array', read: decoder => readUint8Array(decoder, defLen), write: writeUint8Array, gen: gen => uint8Array(gen, defLen), compare: compare },
4671
- { name: 'varUint8Array', read: readVarUint8Array, write: writeVarUint8Array, gen: gen => uint8Array(gen, uint32$1(gen, 0, defLen)), compare: compare },
4672
- { name: 'uint8', read: readUint8, write: writeUint8, gen: gen => uint32$1(gen, 0, BITS8), compare: strictComparison },
4673
- { name: 'uint16', read: readUint16, write: writeUint16, gen: gen => uint32$1(gen, 0, BITS16), compare: strictComparison },
4674
- { name: 'uint32', read: readUint32, write: writeUint32, gen: gen => uint32$1(gen, 0, BITS32), compare: strictComparison },
4675
- { name: 'uint32bigEndian', read: readUint32BigEndian, write: writeUint32BigEndian, gen: gen => uint32$1(gen, 0, BITS32), compare: strictComparison },
4676
- { name: 'varString', read: readVarString, write: writeVarString, gen: gen => utf16String(gen, uint32$1(gen, 0, defLen)), compare: strictComparison },
4688
+ { name: 'varUint8Array', read: readVarUint8Array, write: writeVarUint8Array, gen: gen => uint8Array(gen, uint32(gen, 0, defLen)), compare: compare },
4689
+ { name: 'uint8', read: readUint8, write: writeUint8, gen: gen => uint32(gen, 0, BITS8), compare: strictComparison },
4690
+ { name: 'uint16', read: readUint16, write: writeUint16, gen: gen => uint32(gen, 0, BITS16), compare: strictComparison },
4691
+ { name: 'uint32', read: readUint32, write: writeUint32, gen: gen => uint32(gen, 0, BITS32), compare: strictComparison },
4692
+ { name: 'uint32bigEndian', read: readUint32BigEndian, write: writeUint32BigEndian, gen: gen => uint32(gen, 0, BITS32), compare: strictComparison },
4693
+ { name: 'varString', read: readVarString, write: writeVarString, gen: gen => utf16String(gen, uint32(gen, 0, defLen)), compare: strictComparison },
4677
4694
  { name: 'varUint', read: readVarUint, write: writeVarUint, gen: gen => uint53(gen, 0, BITS32), compare: strictComparison },
4678
4695
  { name: 'varInt', read: readVarInt, write: writeVarInt, gen: gen => int53(gen, LOWEST_INT32, HIGHEST_INT32), compare: strictComparison },
4679
4696
  { name: 'Any', read: readAny, write: writeAny, gen: genAny, compare: compare }
@@ -4702,7 +4719,7 @@ const testRepeatRandomWrites = tc => {
4702
4719
  writeUint8Array(encoder, tailData);
4703
4720
  const buf = toUint8Array(encoder);
4704
4721
  const decoder = createDecoder(buf);
4705
- assert(length$1(encoder) === buf.byteLength);
4722
+ assert(length(encoder) === buf.byteLength);
4706
4723
  for (let i = 0; i < ops.length; i++) {
4707
4724
  const o = ops[i];
4708
4725
  const val = o.read(decoder);
@@ -4740,7 +4757,7 @@ const testSetOnOverflow = tc => {
4740
4757
  encoder.cpos = initialLen - 2;
4741
4758
  writeUint32(encoder, BITS32);
4742
4759
  const buf = toUint8Array(encoder);
4743
- assert(length$1(encoder) === initialLen + 2);
4760
+ assert(length(encoder) === initialLen + 2);
4744
4761
  const decoder = createDecoder(buf);
4745
4762
  const space = createUint8ArrayFromArrayBuffer(readUint8Array(decoder, initialLen - 2));
4746
4763
  for (let i = 0; i < initialLen - 2; i++) {
@@ -5065,7 +5082,7 @@ const testComparing = tc => {
5065
5082
  compare([1, 2], [1, 2], 'simple compare (array)');
5066
5083
  compare({ a: [1, 2] }, { a: [1, 2] }, 'simple compare nested');
5067
5084
  compare(new Set(['3', 1234]), new Set(['3', 1234]), 'compare Sets');
5068
- const map1 = create();
5085
+ const map1 = create$7();
5069
5086
  map1.set(1, 2);
5070
5087
  map1.set('x', {});
5071
5088
  map1.set(98, 'tst');
@@ -5169,17 +5186,17 @@ const testSkipping = () => {
5169
5186
  };
5170
5187
 
5171
5188
  const testAsync = async () => {
5172
- await measureTimeAsync('time', () => create$5(r => setTimeout(r)));
5189
+ await measureTimeAsync('time', () => create$2(r => setTimeout(r)));
5173
5190
  await groupAsync('some description', () => wait(1));
5174
5191
  };
5175
5192
 
5176
- const testRepeatRepitition = () => {
5193
+ const testRepeatRepetition = () => {
5177
5194
  const arr = [];
5178
5195
  const n = 100;
5179
5196
  for (let i = 1; i <= n; i++) {
5180
5197
  arr.push(i);
5181
5198
  }
5182
- assert(arr.reduce(add, 0) === (n + 1) * n / 2);
5199
+ assert(arr.reduce(add$1, 0) === (n + 1) * n / 2);
5183
5200
  };
5184
5201
 
5185
5202
  var testing = /*#__PURE__*/Object.freeze({
@@ -5188,7 +5205,7 @@ var testing = /*#__PURE__*/Object.freeze({
5188
5205
  testFailing: testFailing,
5189
5206
  testSkipping: testSkipping,
5190
5207
  testAsync: testAsync,
5191
- testRepeatRepitition: testRepeatRepitition
5208
+ testRepeatRepetition: testRepeatRepetition
5192
5209
  });
5193
5210
 
5194
5211
  /**
@@ -5197,23 +5214,23 @@ var testing = /*#__PURE__*/Object.freeze({
5197
5214
  * @module error
5198
5215
  */
5199
5216
 
5217
+ /* istanbul ignore next */
5200
5218
  /**
5201
5219
  * @param {string} s
5202
5220
  * @return {Error}
5203
5221
  */
5204
- /* istanbul ignore next */
5205
- const create$6 = s => new Error(s);
5222
+ const create$1 = s => new Error(s);
5206
5223
 
5207
5224
  /* eslint-env browser */
5208
5225
 
5226
+ /* istanbul ignore next */
5209
5227
  /**
5210
5228
  * IDB Request to Promise transformer
5211
5229
  *
5212
5230
  * @param {IDBRequest} request
5213
5231
  * @return {Promise<any>}
5214
5232
  */
5215
- /* istanbul ignore next */
5216
- const rtop = request => create$5((resolve, reject) => {
5233
+ const rtop = request => create$2((resolve, reject) => {
5217
5234
  /* istanbul ignore next */
5218
5235
  // @ts-ignore
5219
5236
  request.onerror = event => reject(new Error(event.target.error));
@@ -5224,13 +5241,13 @@ const rtop = request => create$5((resolve, reject) => {
5224
5241
  request.onsuccess = event => resolve(event.target.result);
5225
5242
  });
5226
5243
 
5244
+ /* istanbul ignore next */
5227
5245
  /**
5228
5246
  * @param {string} name
5229
5247
  * @param {function(IDBDatabase):any} initDB Called when the database is first created
5230
5248
  * @return {Promise<IDBDatabase>}
5231
5249
  */
5232
- /* istanbul ignore next */
5233
- const openDB = (name, initDB) => create$5((resolve, reject) => {
5250
+ const openDB = (name, initDB) => create$2((resolve, reject) => {
5234
5251
  const request = indexedDB.open(name);
5235
5252
  /**
5236
5253
  * @param {any} event
@@ -5240,7 +5257,7 @@ const openDB = (name, initDB) => create$5((resolve, reject) => {
5240
5257
  /**
5241
5258
  * @param {any} event
5242
5259
  */
5243
- request.onerror = event => reject(create$6(event.target.error));
5260
+ request.onerror = event => reject(create$1(event.target.error));
5244
5261
  /* istanbul ignore next */
5245
5262
  request.onblocked = () => location.reload();
5246
5263
  /**
@@ -5261,82 +5278,82 @@ const openDB = (name, initDB) => create$5((resolve, reject) => {
5261
5278
  };
5262
5279
  });
5263
5280
 
5281
+ /* istanbul ignore next */
5264
5282
  /**
5265
5283
  * @param {string} name
5266
5284
  */
5267
- /* istanbul ignore next */
5268
5285
  const deleteDB = name => rtop(indexedDB.deleteDatabase(name));
5269
5286
 
5287
+ /* istanbul ignore next */
5270
5288
  /**
5271
5289
  * @param {IDBDatabase} db
5272
5290
  * @param {Array<Array<string>|Array<string|IDBObjectStoreParameters|undefined>>} definitions
5273
5291
  */
5274
- /* istanbul ignore next */
5275
5292
  const createStores = (db, definitions) => definitions.forEach(d =>
5276
5293
  // @ts-ignore
5277
5294
  db.createObjectStore.apply(db, d)
5278
5295
  );
5279
5296
 
5297
+ /* istanbul ignore next */
5280
5298
  /**
5281
5299
  * @param {IDBObjectStore} store
5282
5300
  * @param {String | number | ArrayBuffer | Date | Array<any> } key
5283
5301
  * @return {Promise<String | number | ArrayBuffer | Date | Array<any>>}
5284
5302
  */
5285
- /* istanbul ignore next */
5286
5303
  const get = (store, key) =>
5287
5304
  rtop(store.get(key));
5288
5305
 
5306
+ /* istanbul ignore next */
5289
5307
  /**
5290
5308
  * @param {IDBObjectStore} store
5291
5309
  * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array<any> } key
5292
5310
  */
5293
- /* istanbul ignore next */
5294
5311
  const del = (store, key) =>
5295
5312
  rtop(store.delete(key));
5296
5313
 
5314
+ /* istanbul ignore next */
5297
5315
  /**
5298
5316
  * @param {IDBObjectStore} store
5299
5317
  * @param {String | number | ArrayBuffer | Date | boolean} item
5300
5318
  * @param {String | number | ArrayBuffer | Date | Array<any>} [key]
5301
5319
  */
5302
- /* istanbul ignore next */
5303
5320
  const put = (store, item, key) =>
5304
5321
  rtop(store.put(item, key));
5305
5322
 
5323
+ /* istanbul ignore next */
5306
5324
  /**
5307
5325
  * @param {IDBObjectStore} store
5308
5326
  * @param {String | number | ArrayBuffer | Date | boolean} item
5309
5327
  * @param {String | number | ArrayBuffer | Date | Array<any>} key
5310
5328
  * @return {Promise<any>}
5311
5329
  */
5312
- /* istanbul ignore next */
5313
- const add$1 = (store, item, key) =>
5330
+ const add = (store, item, key) =>
5314
5331
  rtop(store.add(item, key));
5315
5332
 
5333
+ /* istanbul ignore next */
5316
5334
  /**
5317
5335
  * @param {IDBObjectStore} store
5318
5336
  * @param {String | number | ArrayBuffer | Date} item
5319
5337
  * @return {Promise<number>} Returns the generated key
5320
5338
  */
5321
- /* istanbul ignore next */
5322
5339
  const addAutoKey = (store, item) =>
5323
5340
  rtop(store.add(item));
5324
5341
 
5342
+ /* istanbul ignore next */
5325
5343
  /**
5326
5344
  * @param {IDBObjectStore} store
5327
5345
  * @param {IDBKeyRange} [range]
5328
5346
  * @return {Promise<Array<any>>}
5329
5347
  */
5330
- /* istanbul ignore next */
5331
5348
  const getAll = (store, range) =>
5332
5349
  rtop(store.getAll(range));
5333
5350
 
5351
+ /* istanbul ignore next */
5334
5352
  /**
5335
5353
  * @param {IDBObjectStore} store
5336
5354
  * @param {IDBKeyRange} [range]
5337
5355
  * @return {Promise<Array<any>>}
5338
5356
  */
5339
- /* istanbul ignore next */
5340
5357
  const getAllKeys = (store, range) =>
5341
5358
  rtop(store.getAllKeys(range));
5342
5359
 
@@ -5347,23 +5364,23 @@ const getAllKeys = (store, range) =>
5347
5364
  * @property {any} v Value
5348
5365
  */
5349
5366
 
5367
+ /* istanbul ignore next */
5350
5368
  /**
5351
5369
  * @param {IDBObjectStore} store
5352
5370
  * @param {IDBKeyRange} [range]
5353
5371
  * @return {Promise<Array<KeyValuePair>>}
5354
5372
  */
5355
- /* istanbul ignore next */
5356
5373
  const getAllKeysValues = (store, range) =>
5357
5374
  // @ts-ignore
5358
5375
  all([getAllKeys(store, range), getAll(store, range)]).then(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] })));
5359
5376
 
5377
+ /* istanbul ignore next */
5360
5378
  /**
5361
5379
  * @param {any} request
5362
5380
  * @param {function(IDBCursorWithValue):void|boolean} f
5363
5381
  * @return {Promise<void>}
5364
5382
  */
5365
- /* istanbul ignore next */
5366
- const iterateOnRequest = (request, f) => create$5((resolve, reject) => {
5383
+ const iterateOnRequest = (request, f) => create$2((resolve, reject) => {
5367
5384
  /* istanbul ignore next */
5368
5385
  request.onerror = reject;
5369
5386
  /**
@@ -5378,6 +5395,7 @@ const iterateOnRequest = (request, f) => create$5((resolve, reject) => {
5378
5395
  };
5379
5396
  });
5380
5397
 
5398
+ /* istanbul ignore next */
5381
5399
  /**
5382
5400
  * Iterate on keys and values
5383
5401
  * @param {IDBObjectStore} store
@@ -5385,10 +5403,10 @@ const iterateOnRequest = (request, f) => create$5((resolve, reject) => {
5385
5403
  * @param {function(any,any):void|boolean} f Callback that receives (value, key)
5386
5404
  * @param {'next'|'prev'|'nextunique'|'prevunique'} direction
5387
5405
  */
5388
- /* istanbul ignore next */
5389
5406
  const iterate = (store, keyrange, f, direction = 'next') =>
5390
5407
  iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key));
5391
5408
 
5409
+ /* istanbul ignore next */
5392
5410
  /**
5393
5411
  * Iterate on the keys (no values)
5394
5412
  *
@@ -5397,26 +5415,25 @@ const iterate = (store, keyrange, f, direction = 'next') =>
5397
5415
  * @param {function(any):void|boolean} f callback that receives the key
5398
5416
  * @param {'next'|'prev'|'nextunique'|'prevunique'} direction
5399
5417
  */
5400
- /* istanbul ignore next */
5401
5418
  const iterateKeys = (store, keyrange, f, direction = 'next') =>
5402
5419
  iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key));
5403
5420
 
5421
+ /* istanbul ignore next */
5404
5422
  /**
5405
5423
  * Open store from transaction
5406
5424
  * @param {IDBTransaction} t
5407
5425
  * @param {String} store
5408
5426
  * @returns {IDBObjectStore}
5409
5427
  */
5410
- /* istanbul ignore next */
5411
- const getStore = (t, store) => t.objectStore(store);
5428
+ const getStore$1 = (t, store) => t.objectStore(store);
5412
5429
 
5430
+ /* istanbul ignore next */
5413
5431
  /**
5414
5432
  * @param {any} lower
5415
5433
  * @param {any} upper
5416
5434
  * @param {boolean} lowerOpen
5417
5435
  * @param {boolean} upperOpen
5418
5436
  */
5419
- /* istanbul ignore next */
5420
5437
  const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);
5421
5438
 
5422
5439
  /* istanbul ignore next */
@@ -5437,7 +5454,7 @@ const createTransaction = db => db.transaction(['test'], 'readwrite');
5437
5454
  * @param {IDBTransaction} t
5438
5455
  * @return {IDBObjectStore}
5439
5456
  */
5440
- const getStore$1 = t => getStore(t, 'test');
5457
+ const getStore = t => getStore$1(t, 'test');
5441
5458
 
5442
5459
  /* istanbul ignore next */
5443
5460
  const testRetrieveElements = async () => {
@@ -5446,7 +5463,7 @@ const testRetrieveElements = async () => {
5446
5463
  await deleteDB(testDBName);
5447
5464
  const db = await openDB(testDBName, initTestDB);
5448
5465
  const transaction = createTransaction(db);
5449
- const store = getStore$1(transaction);
5466
+ const store = getStore(transaction);
5450
5467
  await put(store, 0, ['t', 1]);
5451
5468
  await put(store, 1, ['t', 2]);
5452
5469
  const expectedKeys = [['t', 1], ['t', 2]];
@@ -5501,7 +5518,7 @@ const testRetrieveElements = async () => {
5501
5518
  const getVDel = await get(store, ['t', 0]);
5502
5519
  assert(getVDel === undefined);
5503
5520
  describe('idb.add');
5504
- await add$1(store, 99, 42);
5521
+ await add(store, 99, 42);
5505
5522
  const idbVAdd = await get(store, 42);
5506
5523
  assert(idbVAdd === 99);
5507
5524
  describe('idb.addAutoKey');
@@ -5598,7 +5615,7 @@ const genTestData = 5000;
5598
5615
  * @param {prng.PRNG} gen
5599
5616
  */
5600
5617
  const runGenTest = (tc, gen) => {
5601
- group$1('next - average distribution', () => {
5618
+ group('next - average distribution', () => {
5602
5619
  let sum = 0;
5603
5620
  for (let i = 0; i < genTestData; i++) {
5604
5621
  const next = gen.next();
@@ -5612,7 +5629,7 @@ const runGenTest = (tc, gen) => {
5612
5629
  assert(avg <= 0.55);
5613
5630
  });
5614
5631
 
5615
- group$1('bool - bool distribution is fair', () => {
5632
+ group('bool - bool distribution is fair', () => {
5616
5633
  let head = 0;
5617
5634
  let tail = 0;
5618
5635
  let b;
@@ -5630,12 +5647,12 @@ const runGenTest = (tc, gen) => {
5630
5647
  assert(tail >= floor(genTestData * 0.45), 'Generated enough tails.');
5631
5648
  assert(head >= floor(genTestData * 0.45), 'Generated enough heads.');
5632
5649
  });
5633
- group$1('int31 - integers average correctly', () => {
5650
+ group('int31 - integers average correctly', () => {
5634
5651
  let count = 0;
5635
5652
  let i;
5636
5653
 
5637
5654
  for (i = 0; i < genTestData; i++) {
5638
- count += uint32$1(gen, 0, 100);
5655
+ count += uint32(gen, 0, 100);
5639
5656
  }
5640
5657
  const average = count / genTestData;
5641
5658
  const expectedAverage = 100 / 2;
@@ -5643,7 +5660,7 @@ const runGenTest = (tc, gen) => {
5643
5660
  assert(abs(average - expectedAverage) <= 2, 'Expected average is at most 1 off.');
5644
5661
  });
5645
5662
 
5646
- group$1('int32 - generates integer with 32 bits', () => {
5663
+ group('int32 - generates integer with 32 bits', () => {
5647
5664
  let largest = 0;
5648
5665
  let smallest = 0;
5649
5666
  let i;
@@ -5664,12 +5681,12 @@ const runGenTest = (tc, gen) => {
5664
5681
  assert((smallest & BIT32) !== 0, 'Largest number is 32 bits long'); // largest.. assuming we convert int to uint
5665
5682
  });
5666
5683
 
5667
- group$1('uint32 - generates unsigned integer with 32 bits', () => {
5684
+ group('uint32 - generates unsigned integer with 32 bits', () => {
5668
5685
  let num = 0;
5669
5686
  let i;
5670
5687
  let newNum;
5671
5688
  for (i = 0; i < genTestData; i++) {
5672
- newNum = uint32$1(gen, 0, BITS32);
5689
+ newNum = uint32(gen, 0, BITS32);
5673
5690
  if (newNum > num) {
5674
5691
  num = newNum;
5675
5692
  }
@@ -5678,7 +5695,7 @@ const runGenTest = (tc, gen) => {
5678
5695
  assert((num & BIT32) !== 0, 'Largest number is 32 bits long.');
5679
5696
  });
5680
5697
 
5681
- group$1('int53 - generates integer exceeding 32 bits', () => {
5698
+ group('int53 - generates integer exceeding 32 bits', () => {
5682
5699
  let largest = 0;
5683
5700
  let smallest = 0;
5684
5701
  let i;
@@ -5700,7 +5717,7 @@ const runGenTest = (tc, gen) => {
5700
5717
  assert(smallest < BITS32, 'Smallest Number is smaller than BITS32 (negative)');
5701
5718
  });
5702
5719
 
5703
- group$1('uint53 - generates integer exceeding 32 bits', () => {
5720
+ group('uint53 - generates integer exceeding 32 bits', () => {
5704
5721
  let largest = 0;
5705
5722
  let smallest = 10000;
5706
5723
  let i;
@@ -5722,12 +5739,12 @@ const runGenTest = (tc, gen) => {
5722
5739
  assert(largest > (BITS32 >>> 0), 'Largest number exceeds BITS32');
5723
5740
  });
5724
5741
 
5725
- group$1('int31 - generates integer with 31 bits', () => {
5742
+ group('int31 - generates integer with 31 bits', () => {
5726
5743
  let num = 0;
5727
5744
  let i;
5728
5745
  let newNum;
5729
5746
  for (i = 0; i < genTestData; i++) {
5730
- newNum = uint32$1(gen, 0, BITS31);
5747
+ newNum = uint32(gen, 0, BITS31);
5731
5748
  if (newNum > num) {
5732
5749
  num = newNum;
5733
5750
  }
@@ -5736,7 +5753,7 @@ const runGenTest = (tc, gen) => {
5736
5753
  assert((num & BIT31) !== 0, 'Largest number is 31 bits long.');
5737
5754
  });
5738
5755
 
5739
- group$1('real - has 53 bit resolution', () => {
5756
+ group('real - has 53 bit resolution', () => {
5740
5757
  let num = 0;
5741
5758
  let i;
5742
5759
  let newNum;
@@ -5750,7 +5767,7 @@ const runGenTest = (tc, gen) => {
5750
5767
  assert((MAX_SAFE_INTEGER - num) / MAX_SAFE_INTEGER < 0.01, 'Largest number is close to MAX_SAFE_INTEGER (at most 1% off).');
5751
5768
  });
5752
5769
 
5753
- group$1('char - generates all ascii characters', () => {
5770
+ group('char - generates all ascii characters', () => {
5754
5771
  const charSet = new Set();
5755
5772
  const chars = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~"';
5756
5773
  for (let i = chars.length - 1; i >= 0; i--) {
@@ -5804,7 +5821,7 @@ const printDistribution = (gen, tc) => {
5804
5821
  const y = int32(gen, 0, DIAMETER);
5805
5822
  ctx.fillRect(x, y, 1, 2);
5806
5823
  }
5807
- printCanvas$1(canvas$1, DIAMETER);
5824
+ printCanvas(canvas$1, DIAMETER);
5808
5825
  };
5809
5826
 
5810
5827
  /* istanbul ignore next */
@@ -5813,9 +5830,9 @@ const printDistribution = (gen, tc) => {
5813
5830
  */
5814
5831
  const testNumberDistributions = tc => {
5815
5832
  skip(!isBrowser);
5816
- group$1('Xoroshiro128plus', () => printDistribution(new Xoroshiro128plus(tc.seed), tc));
5817
- group$1('Xorshift32', () => printDistribution(new Xorshift32(tc.seed), tc));
5818
- group$1('MT19937', () => printDistribution(new Mt19937(tc.seed), tc));
5833
+ group('Xoroshiro128plus', () => printDistribution(new Xoroshiro128plus(tc.seed), tc));
5834
+ group('Xorshift32', () => printDistribution(new Xorshift32(tc.seed), tc));
5835
+ group('MT19937', () => printDistribution(new Mt19937(tc.seed), tc));
5819
5836
  };
5820
5837
 
5821
5838
  var prng = /*#__PURE__*/Object.freeze({
@@ -5830,7 +5847,7 @@ var prng = /*#__PURE__*/Object.freeze({
5830
5847
  * @param {t.TestCase} tc
5831
5848
  */
5832
5849
  const testMedian = tc => {
5833
- assert(isNaN(median([])), 'median([]) = NaN');
5850
+ assert(isNaN$1(median([])), 'median([]) = NaN');
5834
5851
  assert(median([1]) === 1, 'median([x]) = x');
5835
5852
  assert(median([1, 2, 3]) === 2, 'median([a,b,c]) = b');
5836
5853
  assert(median([1, 2, 3, 4]) === (2 + 3) / 2, 'median([a,b,c,d]) = (b+c)/2');
@@ -5849,7 +5866,7 @@ var statistics = /*#__PURE__*/Object.freeze({
5849
5866
  const testBitx = tc => {
5850
5867
  for (let i = 1; i <= 32; i++) {
5851
5868
  // @ts-ignore
5852
- assert(binary[`BIT${i}`] === (1 << (i - 1)), `BIT${i}=${1 << (i - 1)}`);
5869
+ assert(binary$1[`BIT${i}`] === (1 << (i - 1)), `BIT${i}=${1 << (i - 1)}`);
5853
5870
  }
5854
5871
  };
5855
5872
 
@@ -5861,13 +5878,13 @@ const testBitsx = tc => {
5861
5878
  for (let i = 1; i < 32; i++) {
5862
5879
  const expected = ((1 << i) - 1) >>> 0;
5863
5880
  // @ts-ignore
5864
- const have = binary[`BITS${i}`];
5881
+ const have = binary$1[`BITS${i}`];
5865
5882
  assert(have === expected, `BITS${i}=${have}=${expected}`);
5866
5883
  }
5867
5884
  assert(BITS32 === 0xFFFFFFFF);
5868
5885
  };
5869
5886
 
5870
- var binary$1 = /*#__PURE__*/Object.freeze({
5887
+ var binary = /*#__PURE__*/Object.freeze({
5871
5888
  __proto__: null,
5872
5889
  testBitx: testBitx,
5873
5890
  testBitsx: testBitsx
@@ -5884,7 +5901,7 @@ const testUint32 = tc => {
5884
5901
  let lenSum = 0;
5885
5902
  let ones = 0;
5886
5903
  for (let i = 0; i < iterations; i++) {
5887
- newNum = uint32();
5904
+ newNum = uint32$1();
5888
5905
  lenSum += newNum.toString().length;
5889
5906
  ones += newNum.toString(2).split('').filter(x => x === '1').length;
5890
5907
  if (newNum > largest) {
@@ -5956,7 +5973,7 @@ const measureP = (p, min, max) => {
5956
5973
  * @param {Promise<T>} p
5957
5974
  * @return {Promise<T>}
5958
5975
  */
5959
- const failsP = p => create$5((resolve, reject) => p.then(() => reject(create$6('Promise should fail')), resolve));
5976
+ const failsP = p => create$2((resolve, reject) => p.then(() => reject(create$1('Promise should fail')), resolve));
5960
5977
 
5961
5978
  /**
5962
5979
  * @param {t.TestCase} tc
@@ -5982,7 +5999,7 @@ const testRepeatPromise = async tc => {
5982
5999
  */
5983
6000
  const testispromise = tc => {
5984
6001
  assert(isPromise(new Promise(() => {})));
5985
- assert(isPromise(create$5(() => {})));
6002
+ assert(isPromise(create$2(() => {})));
5986
6003
  const rej = reject();
5987
6004
  assert(isPromise(rej));
5988
6005
  rej.catch(() => {});
@@ -6027,7 +6044,7 @@ class Queue {
6027
6044
  *
6028
6045
  * @return {Queue}
6029
6046
  */
6030
- const create$7 = () => new Queue();
6047
+ const create = () => new Queue();
6031
6048
 
6032
6049
  /**
6033
6050
  * @param {Queue} queue
@@ -6038,7 +6055,7 @@ const isEmpty = queue => queue.start === null;
6038
6055
  * @param {Queue} queue
6039
6056
  * @param {QueueNode} n
6040
6057
  */
6041
- const enqueue$1 = (queue, n) => {
6058
+ const enqueue = (queue, n) => {
6042
6059
  if (queue.end !== null) {
6043
6060
  queue.end.next = n;
6044
6061
  queue.end = n;
@@ -6080,11 +6097,11 @@ const testEnqueueDequeue = tc => {
6080
6097
  /**
6081
6098
  * @type {queue.Queue}
6082
6099
  */
6083
- const q = create$7();
6100
+ const q = create();
6084
6101
  assert(isEmpty(q));
6085
6102
  assert(dequeue(q) === null);
6086
6103
  for (let i = 0; i < N; i++) {
6087
- enqueue$1(q, new QueueItem(i));
6104
+ enqueue(q, new QueueItem(i));
6088
6105
  assert(!isEmpty(q));
6089
6106
  }
6090
6107
  for (let i = 0; i < N; i++) {
@@ -6094,7 +6111,7 @@ const testEnqueueDequeue = tc => {
6094
6111
  assert(dequeue(q) === null);
6095
6112
  };
6096
6113
 
6097
- var queue$1 = /*#__PURE__*/Object.freeze({
6114
+ var queue = /*#__PURE__*/Object.freeze({
6098
6115
  __proto__: null,
6099
6116
  testEnqueueDequeue: testEnqueueDequeue
6100
6117
  });
@@ -6103,10 +6120,10 @@ var queue$1 = /*#__PURE__*/Object.freeze({
6103
6120
  * @param {t.TestCase} tc
6104
6121
  */
6105
6122
  const testMap = tc => {
6106
- const m = create();
6123
+ const m = create$7();
6107
6124
  m.set(1, 2);
6108
6125
  m.set(2, 3);
6109
- assert(map(m, (value, key) => value * 2 + key).reduce(add) === 13);
6126
+ assert(map$3(m, (value, key) => value * 2 + key).reduce(add$1) === 13);
6110
6127
  let numberOfWrites = 0;
6111
6128
  const createT = () => {
6112
6129
  numberOfWrites++;
@@ -6119,7 +6136,7 @@ const testMap = tc => {
6119
6136
  assert(numberOfWrites === 1);
6120
6137
  };
6121
6138
 
6122
- var map$3 = /*#__PURE__*/Object.freeze({
6139
+ var map = /*#__PURE__*/Object.freeze({
6123
6140
  __proto__: null,
6124
6141
  testMap: testMap
6125
6142
  });
@@ -6131,16 +6148,16 @@ const testEventloopOrder = tc => {
6131
6148
  let currI = 0;
6132
6149
  for (let i = 0; i < 10; i++) {
6133
6150
  const bi = i;
6134
- enqueue(() => {
6151
+ enqueue$1(() => {
6135
6152
  assert(currI++ === bi);
6136
6153
  });
6137
6154
  }
6138
- enqueue(() => {
6155
+ enqueue$1(() => {
6139
6156
  assert(currI === 10);
6140
6157
  });
6141
6158
  assert(currI === 0);
6142
6159
  return all([
6143
- createEmpty(resolve => enqueue(resolve)),
6160
+ createEmpty(resolve => enqueue$1(resolve)),
6144
6161
  until(0, () => currI === 10)
6145
6162
  ])
6146
6163
  };
@@ -6154,7 +6171,7 @@ const testTimeout = async tc => {
6154
6171
  set = true;
6155
6172
  });
6156
6173
  timeout$1.destroy();
6157
- await create$5(resolve => {
6174
+ await create$2(resolve => {
6158
6175
  timeout(10, resolve);
6159
6176
  });
6160
6177
  assert(set === false);
@@ -6192,7 +6209,7 @@ const testAnimationFrame = async tc => {
6192
6209
  * @param {t.TestCase} tc
6193
6210
  */
6194
6211
  const testIdleCallback = async tc => {
6195
- await create$5(resolve => {
6212
+ await create$2(resolve => {
6196
6213
  idleCallback(resolve);
6197
6214
  });
6198
6215
  };
@@ -6247,18 +6264,18 @@ var time = /*#__PURE__*/Object.freeze({
6247
6264
  * @param {t.TestCase} tc
6248
6265
  */
6249
6266
  const testPair = tc => {
6250
- const ps = [create$2(1, 2), create$2(3, 4), createReversed(6, 5)];
6267
+ const ps = [create$5(1, 2), create$5(3, 4), createReversed(6, 5)];
6251
6268
  describe('Counting elements in pair list');
6252
6269
  let countLeft = 0;
6253
6270
  let countRight = 0;
6254
- forEach(ps, (left, right) => {
6271
+ forEach$1(ps, (left, right) => {
6255
6272
  countLeft += left;
6256
6273
  countRight += right;
6257
6274
  });
6258
6275
  assert(countLeft === 9);
6259
6276
  assert(countRight === 12);
6260
- assert(countLeft === map$1(ps, left => left).reduce(add));
6261
- assert(countRight === map$1(ps, (left, right) => right).reduce(add));
6277
+ assert(countLeft === map$2(ps, left => left).reduce(add$1));
6278
+ assert(countRight === map$2(ps, (left, right) => right).reduce(add$1));
6262
6279
  };
6263
6280
 
6264
6281
  var pair = /*#__PURE__*/Object.freeze({
@@ -6270,17 +6287,17 @@ var pair = /*#__PURE__*/Object.freeze({
6270
6287
  * @param {t.TestCase} tc
6271
6288
  */
6272
6289
  const testObject = tc => {
6273
- assert(create$3().constructor === undefined, 'object.create creates an empty object without constructor');
6290
+ assert(create$4().constructor === undefined, 'object.create creates an empty object without constructor');
6274
6291
  describe('object.equalFlat');
6275
- assert(equalFlat$1({}, {}), 'comparing equal objects');
6276
- assert(equalFlat$1({ x: 1 }, { x: 1 }), 'comparing equal objects');
6277
- assert(equalFlat$1({ x: 'dtrn' }, { x: 'dtrn' }), 'comparing equal objects');
6278
- assert(!equalFlat$1({ x: {} }, { x: {} }), 'flatEqual does not dive deep');
6279
- assert(equalFlat$1({ x: undefined }, { x: undefined }), 'flatEqual handles undefined');
6280
- assert(!equalFlat$1({ x: undefined }, { y: {} }), 'flatEqual handles undefined');
6292
+ assert(equalFlat({}, {}), 'comparing equal objects');
6293
+ assert(equalFlat({ x: 1 }, { x: 1 }), 'comparing equal objects');
6294
+ assert(equalFlat({ x: 'dtrn' }, { x: 'dtrn' }), 'comparing equal objects');
6295
+ assert(!equalFlat({ x: {} }, { x: {} }), 'flatEqual does not dive deep');
6296
+ assert(equalFlat({ x: undefined }, { x: undefined }), 'flatEqual handles undefined');
6297
+ assert(!equalFlat({ x: undefined }, { y: {} }), 'flatEqual handles undefined');
6281
6298
  describe('object.every');
6282
- assert(every$1({ a: 1, b: 3 }, (v, k) => (v % 2) === 1 && k !== 'c'));
6283
- assert(!every$1({ a: 1, b: 3, c: 5 }, (v, k) => (v % 2) === 1 && k !== 'c'));
6299
+ assert(every({ a: 1, b: 3 }, (v, k) => (v % 2) === 1 && k !== 'c'));
6300
+ assert(!every({ a: 1, b: 3, c: 5 }, (v, k) => (v % 2) === 1 && k !== 'c'));
6284
6301
  describe('object.some');
6285
6302
  assert(some({ a: 1, b: 3 }, (v, k) => v === 3 && k === 'b'));
6286
6303
  assert(!some({ a: 1, b: 5 }, (v, k) => v === 3));
@@ -6288,13 +6305,13 @@ const testObject = tc => {
6288
6305
  assert(!some({ a: 1, b: 5 }, (v, k) => false));
6289
6306
  describe('object.forEach');
6290
6307
  let forEachSum = 0;
6291
- forEach$1({ x: 1, y: 3 }, (v, k) => { forEachSum += v; });
6308
+ forEach({ x: 1, y: 3 }, (v, k) => { forEachSum += v; });
6292
6309
  assert(forEachSum === 4);
6293
6310
  describe('object.map');
6294
- assert(map$2({ x: 1, z: 5 }, (v, k) => v).reduce(add) === 6);
6311
+ assert(map$1({ x: 1, z: 5 }, (v, k) => v).reduce(add$1) === 6);
6295
6312
  describe('object.length');
6296
- assert(length({}) === 0);
6297
- assert(length({ x: 1 }) === 1);
6313
+ assert(length$1({}) === 0);
6314
+ assert(length$1({ x: 1 }) === 1);
6298
6315
  };
6299
6316
 
6300
6317
  var object = /*#__PURE__*/Object.freeze({
@@ -6311,7 +6328,7 @@ const testMath = tc => {
6311
6328
  assert(abs(Number.MIN_SAFE_INTEGER) === Number.MAX_SAFE_INTEGER);
6312
6329
  assert(abs(Number.MAX_SAFE_INTEGER) === Number.MAX_SAFE_INTEGER);
6313
6330
  describe('math.add');
6314
- assert([1, 2, 3, 4, 5].reduce(add) === 15);
6331
+ assert([1, 2, 3, 4, 5].reduce(add$1) === 15);
6315
6332
  describe('math.ceil');
6316
6333
  assert(ceil(1.5) === 2);
6317
6334
  assert(ceil(-1.5) === -1);
@@ -6319,9 +6336,9 @@ const testMath = tc => {
6319
6336
  assert(floor(1.5) === 1);
6320
6337
  assert(floor(-1.5) === -2);
6321
6338
  describe('math.isNaN');
6322
- assert(isNaN(NaN));
6339
+ assert(isNaN$1(NaN));
6323
6340
  // @ts-ignore
6324
- assert(!isNaN(null));
6341
+ assert(!isNaN$1(null));
6325
6342
  describe('math.max');
6326
6343
  assert([1, 3, 65, 1, 314, 25, 3475, 2, 1].reduce(max) === 3475);
6327
6344
  describe('math.min');
@@ -6341,11 +6358,11 @@ var math = /*#__PURE__*/Object.freeze({
6341
6358
  */
6342
6359
  const testNumber = tc => {
6343
6360
  describe('isNaN');
6344
- assert(isNaN$1(NaN));
6345
- assert(!isNaN$1(1 / 0));
6361
+ assert(isNaN(NaN));
6362
+ assert(!isNaN(1 / 0));
6346
6363
  // @ts-ignore
6347
- assert(isNaN$1('a' / 0));
6348
- assert(!isNaN$1(0));
6364
+ assert(isNaN('a' / 0));
6365
+ assert(!isNaN(0));
6349
6366
  describe('isInteger');
6350
6367
  assert(!isInteger(1 / 0));
6351
6368
  assert(!isInteger(NaN));
@@ -6683,7 +6700,7 @@ const decodeQueryParams = url => {
6683
6700
  * @return {string}
6684
6701
  */
6685
6702
  const encodeQueryParams = params =>
6686
- map$2(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&');
6703
+ map$1(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&');
6687
6704
 
6688
6705
  /**
6689
6706
  * @param {Object<string,any>} params
@@ -6826,6 +6843,27 @@ var func = /*#__PURE__*/Object.freeze({
6826
6843
  testDeepEquality: testDeepEquality
6827
6844
  });
6828
6845
 
6846
+ /**
6847
+ * @param {t.TestCase} tc
6848
+ */
6849
+ const testStorageModule = tc => {
6850
+ const s = varStorage;
6851
+ /**
6852
+ * @type {any}
6853
+ */
6854
+ let lastEvent = null;
6855
+ onChange(event => {
6856
+ lastEvent = event;
6857
+ });
6858
+ s.setItem('key', 'value');
6859
+ assert(lastEvent === null);
6860
+ };
6861
+
6862
+ var storage = /*#__PURE__*/Object.freeze({
6863
+ __proto__: null,
6864
+ testStorageModule: testStorageModule
6865
+ });
6866
+
6829
6867
  /* istanbul ignore if */
6830
6868
  if (isBrowser) {
6831
6869
  createVConsole(document.body);
@@ -6841,11 +6879,11 @@ runTests({
6841
6879
  indexeddb,
6842
6880
  prng,
6843
6881
  statistics,
6844
- binary: binary$1,
6882
+ binary,
6845
6883
  random,
6846
6884
  promise,
6847
- queue: queue$1,
6848
- map: map$3,
6885
+ queue,
6886
+ map,
6849
6887
  eventloop,
6850
6888
  time,
6851
6889
  pair,
@@ -6856,7 +6894,8 @@ runTests({
6856
6894
  sort,
6857
6895
  url,
6858
6896
  metric,
6859
- func
6897
+ func,
6898
+ storage
6860
6899
  }).then(success => {
6861
6900
  /* istanbul ignore next */
6862
6901
  if (isNode) {