lib0 0.2.62 → 0.2.64
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 +5 -5
- package/array.d.ts +5 -5
- package/array.d.ts.map +1 -1
- package/array.js +26 -10
- package/array.test.d.ts +6 -4
- package/array.test.d.ts.map +1 -1
- package/bin/gendocs.js +0 -1
- package/bin/gentesthtml.js +54 -0
- package/broadcastchannel.d.ts.map +1 -1
- package/broadcastchannel.js +4 -4
- package/buffer.d.ts.map +1 -1
- package/buffer.js +6 -4
- package/conditions.js +1 -1
- package/coverage/tmp/coverage-17397-1678220559587-0.json +1 -0
- package/crypto.d.ts.map +1 -1
- package/crypto.js +6 -5
- package/crypto.test.d.ts.map +1 -1
- package/decoding.d.ts.map +1 -1
- package/decoding.js +7 -4
- package/deno.json +7 -0
- package/deno.lock +122 -0
- package/dist/{array-42d0736b.cjs → array-a1682de6.cjs} +28 -12
- package/dist/array-a1682de6.cjs.map +1 -0
- package/dist/array.cjs +2 -2
- package/dist/array.d.ts +5 -5
- package/dist/array.d.ts.map +1 -1
- package/dist/array.test.d.ts +6 -4
- package/dist/array.test.d.ts.map +1 -1
- package/dist/{broadcastchannel-8d21c21c.cjs → broadcastchannel-4e5909e2.cjs} +8 -8
- package/dist/broadcastchannel-4e5909e2.cjs.map +1 -0
- package/dist/broadcastchannel.cjs +12 -12
- package/dist/broadcastchannel.d.ts.map +1 -1
- package/dist/{buffer-22bb9fae.cjs → buffer-9b566988.cjs} +20 -16
- package/dist/buffer-9b566988.cjs.map +1 -0
- package/dist/buffer.cjs +11 -11
- package/dist/buffer.d.ts.map +1 -1
- package/dist/cache.cjs +7 -7
- package/dist/component.cjs +9 -9
- package/dist/{conditions-fb475c70.cjs → conditions-f5c0c102.cjs} +2 -2
- package/dist/conditions-f5c0c102.cjs.map +1 -0
- package/dist/conditions.cjs +1 -1
- package/dist/crypto.cjs +17 -16
- package/dist/crypto.cjs.map +1 -1
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.test.d.ts.map +1 -1
- package/dist/decoding.cjs +11 -11
- package/dist/decoding.d.ts.map +1 -1
- package/dist/{diff-ee50c530.cjs → diff-55061848.cjs} +2 -2
- package/dist/{diff-ee50c530.cjs.map → diff-55061848.cjs.map} +1 -1
- package/dist/diff.cjs +5 -5
- package/dist/{dom-58958c04.cjs → dom-7ef10fba.cjs} +4 -32
- package/dist/dom-7ef10fba.cjs.map +1 -0
- package/dist/dom.cjs +2 -2
- package/dist/dom.d.ts.map +1 -1
- package/dist/encoding.cjs +11 -11
- package/dist/encoding.d.ts.map +1 -1
- package/dist/encoding.test.d.ts +2 -1
- package/dist/encoding.test.d.ts.map +1 -1
- package/dist/{environment-f6386808.cjs → environment-01c0e75b.cjs} +20 -19
- package/dist/environment-01c0e75b.cjs.map +1 -0
- package/dist/environment.cjs +8 -8
- package/dist/environment.d.ts.map +1 -1
- package/dist/{error-873c9cbf.cjs → error-8582d695.cjs} +4 -4
- package/dist/error-8582d695.cjs.map +1 -0
- package/dist/error.cjs +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/{eventloop-c60b5658.cjs → eventloop-d0571621.cjs} +5 -5
- package/dist/eventloop-d0571621.cjs.map +1 -0
- package/dist/eventloop.cjs +1 -1
- package/dist/eventloop.d.ts.map +1 -1
- package/dist/eventloop.test.d.ts +6 -5
- package/dist/eventloop.test.d.ts.map +1 -1
- package/dist/{function-40d38a5b.cjs → function-35e8ddea.cjs} +6 -3
- package/dist/function-35e8ddea.cjs.map +1 -0
- package/dist/function.cjs +4 -4
- package/dist/function.d.ts.map +1 -1
- package/dist/function.test.d.ts +3 -1
- package/dist/function.test.d.ts.map +1 -1
- package/dist/index.cjs +22 -22
- package/dist/{indexeddb-7b2c0026.cjs → indexeddb-1f25af34.cjs} +7 -30
- package/dist/indexeddb-1f25af34.cjs.map +1 -0
- package/dist/indexeddb.cjs +4 -4
- package/dist/indexeddb.d.ts.map +1 -1
- package/dist/list.cjs +7 -6
- package/dist/list.cjs.map +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.test.d.ts +2 -2
- package/dist/list.test.d.ts.map +1 -1
- package/dist/{logging-ba24d049.cjs → logging-641c32f4.cjs} +55 -50
- package/dist/logging-641c32f4.cjs.map +1 -0
- package/dist/logging.cjs +12 -12
- package/dist/logging.d.ts.map +1 -1
- package/dist/{map-28a001c9.cjs → map-9a5915e4.cjs} +6 -5
- package/dist/map-9a5915e4.cjs.map +1 -0
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.test.d.ts +1 -1
- package/dist/map.test.d.ts.map +1 -1
- package/dist/{number-e62129bc.cjs → number-f97e141a.cjs} +2 -2
- package/dist/number-f97e141a.cjs.map +1 -0
- package/dist/number.cjs +1 -1
- package/dist/{object-fe9c0021.cjs → object-aad630ed.cjs} +6 -3
- package/dist/object-aad630ed.cjs.map +1 -0
- package/dist/object.cjs +1 -1
- package/dist/object.d.ts +3 -3
- package/dist/object.d.ts.map +1 -1
- package/dist/object.test.d.ts.map +1 -1
- package/dist/observable.cjs +3 -3
- package/dist/{prng-4493ba85.cjs → prng-cd2451c9.cjs} +5 -4
- package/dist/prng-cd2451c9.cjs.map +1 -0
- package/dist/prng.cjs +12 -12
- package/dist/prng.d.ts.map +1 -1
- package/dist/{promise-1a9fe712.cjs → promise-a4f32c85.cjs} +3 -3
- package/dist/promise-a4f32c85.cjs.map +1 -0
- package/dist/promise.cjs +2 -2
- package/dist/random.test.d.ts +1 -0
- package/dist/random.test.d.ts.map +1 -1
- package/dist/rollup.config.d.ts +2 -28
- package/dist/{set-b596ef38.cjs → set-0f209abb.cjs} +4 -7
- package/dist/set-0f209abb.cjs.map +1 -0
- package/dist/set.cjs +1 -1
- package/dist/set.d.ts.map +1 -1
- package/dist/set.test.d.ts +1 -1
- package/dist/set.test.d.ts.map +1 -1
- package/dist/sort.test.d.ts +2 -1
- package/dist/sort.test.d.ts.map +1 -1
- package/dist/storage.cjs +6 -5
- package/dist/storage.cjs.map +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/{string-ad04f734.cjs → string-b1bee84b.cjs} +8 -7
- package/dist/string-b1bee84b.cjs.map +1 -0
- package/dist/string.cjs +1 -1
- package/dist/string.d.ts.map +1 -1
- package/dist/symbol.test.d.ts +3 -0
- package/dist/symbol.test.d.ts.map +1 -0
- package/dist/testing.cjs +42 -40
- 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 -0
- package/dist/testing.test.d.ts.map +1 -1
- package/dist/{time-e00067da.cjs → time-bc2081b9.cjs} +2 -2
- package/dist/time-bc2081b9.cjs.map +1 -0
- package/dist/time.cjs +1 -1
- package/dist/{tree-b67c7947.cjs → tree-9f3c8837.cjs} +23 -22
- package/dist/tree-9f3c8837.cjs.map +1 -0
- package/dist/tree.cjs +1 -1
- package/dist/tree.d.ts.map +1 -1
- package/dist/url.cjs +2 -2
- package/dist/url.cjs.map +1 -1
- package/dist/webcrypto.deno.cjs +12 -0
- package/dist/webcrypto.deno.cjs.map +1 -0
- package/dist/webcrypto.deno.d.ts +3 -0
- package/dist/webcrypto.deno.d.ts.map +1 -0
- package/dist/{websocket-a48155c2.cjs → websocket-85f1d597.cjs} +2 -2
- package/dist/{websocket-a48155c2.cjs.map → websocket-85f1d597.cjs.map} +1 -1
- package/dist/websocket.cjs +5 -5
- package/dom.d.ts.map +1 -1
- package/dom.js +2 -30
- package/encoding.d.ts.map +1 -1
- package/encoding.js +2 -3
- package/encoding.test.d.ts +2 -1
- package/encoding.test.d.ts.map +1 -1
- package/environment.d.ts.map +1 -1
- package/environment.js +15 -14
- package/error.d.ts.map +1 -1
- package/error.js +3 -3
- package/eventloop.d.ts.map +1 -1
- package/eventloop.js +4 -4
- package/eventloop.test.d.ts +6 -5
- package/eventloop.test.d.ts.map +1 -1
- package/function.d.ts.map +1 -1
- package/function.js +3 -0
- package/function.test.d.ts +3 -1
- package/function.test.d.ts.map +1 -1
- package/indexeddb.d.ts.map +1 -1
- package/indexeddb.js +4 -27
- package/list.d.ts.map +1 -1
- package/list.js +2 -1
- package/list.test.d.ts +2 -2
- package/list.test.d.ts.map +1 -1
- package/logging.d.ts.map +1 -1
- package/logging.js +47 -42
- package/map.d.ts +1 -1
- package/map.d.ts.map +1 -1
- package/map.js +5 -4
- package/map.test.d.ts +1 -1
- package/map.test.d.ts.map +1 -1
- package/number.js +1 -1
- package/object.d.ts +3 -3
- package/object.d.ts.map +1 -1
- package/object.js +5 -2
- package/object.test.d.ts.map +1 -1
- package/package.json +16 -12
- package/prng.d.ts.map +1 -1
- package/prng.js +2 -1
- package/promise.js +1 -1
- package/random.test.d.ts +1 -0
- package/random.test.d.ts.map +1 -1
- package/rollup.config.d.ts +2 -28
- package/set.d.ts.map +1 -1
- package/set.js +3 -6
- package/set.test.d.ts +1 -1
- package/set.test.d.ts.map +1 -1
- package/sort.test.d.ts +2 -1
- package/sort.test.d.ts.map +1 -1
- package/storage.d.ts.map +1 -1
- package/storage.js +6 -5
- package/string.d.ts.map +1 -1
- package/string.js +7 -6
- package/symbol.test.d.ts +3 -0
- package/symbol.test.d.ts.map +1 -0
- package/test.html +148 -2
- package/test.js +5 -3
- package/testing.d.ts +1 -1
- package/testing.d.ts.map +1 -1
- package/testing.js +24 -22
- package/testing.test.d.ts +1 -0
- package/testing.test.d.ts.map +1 -1
- package/time.js +1 -1
- package/tree.d.ts.map +1 -1
- package/tree.js +22 -21
- package/url.js +1 -1
- package/webcrypto.deno.d.ts +3 -0
- package/webcrypto.deno.d.ts.map +1 -0
- package/webcrypto.deno.js +4 -0
- package/dist/array-42d0736b.cjs.map +0 -1
- package/dist/broadcastchannel-8d21c21c.cjs.map +0 -1
- package/dist/buffer-22bb9fae.cjs.map +0 -1
- package/dist/conditions-fb475c70.cjs.map +0 -1
- package/dist/dom-58958c04.cjs.map +0 -1
- package/dist/environment-f6386808.cjs.map +0 -1
- package/dist/error-873c9cbf.cjs.map +0 -1
- package/dist/eventloop-c60b5658.cjs.map +0 -1
- package/dist/function-40d38a5b.cjs.map +0 -1
- package/dist/indexeddb-7b2c0026.cjs.map +0 -1
- package/dist/logging-ba24d049.cjs.map +0 -1
- package/dist/map-28a001c9.cjs.map +0 -1
- package/dist/number-e62129bc.cjs.map +0 -1
- package/dist/object-fe9c0021.cjs.map +0 -1
- package/dist/prng-4493ba85.cjs.map +0 -1
- package/dist/promise-1a9fe712.cjs.map +0 -1
- package/dist/set-b596ef38.cjs.map +0 -1
- package/dist/string-ad04f734.cjs.map +0 -1
- package/dist/time-e00067da.cjs.map +0 -1
- package/dist/tree-b67c7947.cjs.map +0 -1
package/string.js
CHANGED
|
@@ -51,7 +51,7 @@ export const _encodeUtf8Polyfill = str => {
|
|
|
51
51
|
return buf
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
/*
|
|
54
|
+
/* c8 ignore next */
|
|
55
55
|
export const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null)
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -64,7 +64,7 @@ export const _encodeUtf8Native = str => utf8TextEncoder.encode(str)
|
|
|
64
64
|
* @param {string} str
|
|
65
65
|
* @return {Uint8Array}
|
|
66
66
|
*/
|
|
67
|
-
/*
|
|
67
|
+
/* c8 ignore next */
|
|
68
68
|
export const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill
|
|
69
69
|
|
|
70
70
|
/**
|
|
@@ -86,19 +86,20 @@ export const _decodeUtf8Polyfill = buf => {
|
|
|
86
86
|
return decodeURIComponent(escape(encodedString))
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/*
|
|
89
|
+
/* c8 ignore next */
|
|
90
90
|
export let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true })
|
|
91
91
|
|
|
92
|
-
/*
|
|
92
|
+
/* c8 ignore start */
|
|
93
93
|
if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {
|
|
94
94
|
// Safari doesn't handle BOM correctly.
|
|
95
95
|
// This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called.
|
|
96
96
|
// utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and
|
|
97
97
|
// utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call
|
|
98
98
|
// Another issue is that from then on no BOM chars are recognized anymore
|
|
99
|
-
/*
|
|
99
|
+
/* c8 ignore next */
|
|
100
100
|
utf8TextDecoder = null
|
|
101
101
|
}
|
|
102
|
+
/* c8 ignore stop */
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
105
|
* @param {Uint8Array} buf
|
|
@@ -110,7 +111,7 @@ export const _decodeUtf8Native = buf => /** @type {TextDecoder} */ (utf8TextDeco
|
|
|
110
111
|
* @param {Uint8Array} buf
|
|
111
112
|
* @return {string}
|
|
112
113
|
*/
|
|
113
|
-
/*
|
|
114
|
+
/* c8 ignore next */
|
|
114
115
|
export const decodeUtf8 = utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill
|
|
115
116
|
|
|
116
117
|
/**
|
package/symbol.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol.test.d.ts","sourceRoot":"","sources":["symbol.test.js"],"names":[],"mappings":"AAMO,6CAFI,EAAE,QAAQ,QAQpB"}
|
package/test.html
CHANGED
|
@@ -1,9 +1,155 @@
|
|
|
1
|
+
|
|
1
2
|
<!DOCTYPE html>
|
|
2
3
|
<html>
|
|
3
4
|
<head>
|
|
4
5
|
<title>Testing lib0</title>
|
|
6
|
+
<script type="importmap">
|
|
7
|
+
{
|
|
8
|
+
"imports": {
|
|
9
|
+
"lib0/package.json": "./package.json",
|
|
10
|
+
"lib0": "./index.js",
|
|
11
|
+
"lib0/array.js": "./array.js",
|
|
12
|
+
"lib0/dist/array.cjs": "./dist/array.cjs",
|
|
13
|
+
"lib0/array": "./array.js",
|
|
14
|
+
"lib0/binary.js": "./binary.js",
|
|
15
|
+
"lib0/dist/binary.cjs": "./dist/binary.cjs",
|
|
16
|
+
"lib0/binary": "./binary.js",
|
|
17
|
+
"lib0/broadcastchannel.js": "./broadcastchannel.js",
|
|
18
|
+
"lib0/dist/broadcastchannel.cjs": "./dist/broadcastchannel.cjs",
|
|
19
|
+
"lib0/broadcastchannel": "./broadcastchannel.js",
|
|
20
|
+
"lib0/buffer.js": "./buffer.js",
|
|
21
|
+
"lib0/dist/buffer.cjs": "./dist/buffer.cjs",
|
|
22
|
+
"lib0/buffer": "./buffer.js",
|
|
23
|
+
"lib0/cache.js": "./cache.js",
|
|
24
|
+
"lib0/dist/cache.cjs": "./dist/cache.cjs",
|
|
25
|
+
"lib0/cache": "./cache.js",
|
|
26
|
+
"lib0/component.js": "./component.js",
|
|
27
|
+
"lib0/dist/component.cjs": "./dist/component.cjs",
|
|
28
|
+
"lib0/component": "./component.js",
|
|
29
|
+
"lib0/conditions.js": "./conditions.js",
|
|
30
|
+
"lib0/dist/conditions.cjs": "./dist/conditions.cjs",
|
|
31
|
+
"lib0/conditions": "./condititons.js",
|
|
32
|
+
"lib0/crypto": "./crypto.js",
|
|
33
|
+
"lib0/decoding.js": "./decoding.js",
|
|
34
|
+
"lib0/dist/decoding.cjs": "./dist/decoding.cjs",
|
|
35
|
+
"lib0/decoding": "./decoding.js",
|
|
36
|
+
"lib0/diff.js": "./diff.js",
|
|
37
|
+
"lib0/dist/diff.cjs": "./dist/diff.cjs",
|
|
38
|
+
"lib0/diff": "./diff.js",
|
|
39
|
+
"lib0/dom.js": "./dom.js",
|
|
40
|
+
"lib0/dist/dom.cjs": "./dist/dom.cjs",
|
|
41
|
+
"lib0/dom": "./dom.js",
|
|
42
|
+
"lib0/encoding.js": "./encoding.js",
|
|
43
|
+
"lib0/dist/encoding.cjs": "./dist/encoding.cjs",
|
|
44
|
+
"lib0/encoding": "./encoding.js",
|
|
45
|
+
"lib0/environment.js": "./environment.js",
|
|
46
|
+
"lib0/dist/environment.cjs": "./dist/environment.cjs",
|
|
47
|
+
"lib0/environment": "./environment.js",
|
|
48
|
+
"lib0/error.js": "./error.js",
|
|
49
|
+
"lib0/dist/error.cjs": "./dist/error.cjs",
|
|
50
|
+
"lib0/error": "./error.js",
|
|
51
|
+
"lib0/eventloop.js": "./eventloop.js",
|
|
52
|
+
"lib0/dist/eventloop.cjs": "./dist/eventloop.cjs",
|
|
53
|
+
"lib0/eventloop": "./eventloop.js",
|
|
54
|
+
"lib0/function.js": "./function.js",
|
|
55
|
+
"lib0/dist/function.cjs": "./dist/function.cjs",
|
|
56
|
+
"lib0/function": "./function.js",
|
|
57
|
+
"lib0/indexeddb.js": "./indexeddb.js",
|
|
58
|
+
"lib0/dist/indexeddb.cjs": "./dist/indexeddb.cjs",
|
|
59
|
+
"lib0/indexeddb": "./indexeddb.js",
|
|
60
|
+
"lib0/isomorphic.js": "./isomorphic.js",
|
|
61
|
+
"lib0/dist/isomorphic.cjs": "./dist/isomorphic.cjs",
|
|
62
|
+
"lib0/isomorphic": "./isomorphic.js",
|
|
63
|
+
"lib0/iterator.js": "./iterator.js",
|
|
64
|
+
"lib0/dist/iterator.cjs": "./dist/iterator.cjs",
|
|
65
|
+
"lib0/iterator": "./iterator.js",
|
|
66
|
+
"lib0/json.js": "./json.js",
|
|
67
|
+
"lib0/dist/json.cjs": "./dist/json.cjs",
|
|
68
|
+
"lib0/json": "./json.js",
|
|
69
|
+
"lib0/list.js": "./list.js",
|
|
70
|
+
"lib0/dist/list.cjs": "./dist/list.cjs",
|
|
71
|
+
"lib0/list": "./list.js",
|
|
72
|
+
"lib0/logging.js": "./logging.js",
|
|
73
|
+
"lib0/dist/logging.cjs": "./dist/logging.cjs",
|
|
74
|
+
"lib0/logging": "./logging.js",
|
|
75
|
+
"lib0/map.js": "./map.js",
|
|
76
|
+
"lib0/dist/map.cjs": "./dist/map.cjs",
|
|
77
|
+
"lib0/map": "./map.js",
|
|
78
|
+
"lib0/math.js": "./math.js",
|
|
79
|
+
"lib0/dist/math.cjs": "./dist/math.cjs",
|
|
80
|
+
"lib0/math": "./math.js",
|
|
81
|
+
"lib0/metric.js": "./metric.js",
|
|
82
|
+
"lib0/dist/metric.cjs": "./dist/metric.cjs",
|
|
83
|
+
"lib0/metric": "./metric.js",
|
|
84
|
+
"lib0/mutex.js": "./mutex.js",
|
|
85
|
+
"lib0/dist/mutex.cjs": "./dist/mutex.cjs",
|
|
86
|
+
"lib0/mutex": "./mutex.js",
|
|
87
|
+
"lib0/number.js": "./number.js",
|
|
88
|
+
"lib0/dist/number.cjs": "./dist/number.cjs",
|
|
89
|
+
"lib0/number": "./number.js",
|
|
90
|
+
"lib0/object.js": "./object.js",
|
|
91
|
+
"lib0/dist/object.cjs": "./dist/object.cjs",
|
|
92
|
+
"lib0/object": "./object.js",
|
|
93
|
+
"lib0/observable.js": "./observable.js",
|
|
94
|
+
"lib0/dist/observable.cjs": "./dist/observable.cjs",
|
|
95
|
+
"lib0/observable": "./observable.js",
|
|
96
|
+
"lib0/pair.js": "./pair.js",
|
|
97
|
+
"lib0/dist/pair.cjs": "./dist/pair.cjs",
|
|
98
|
+
"lib0/pair": "./pair.js",
|
|
99
|
+
"lib0/prng.js": "./prng.js",
|
|
100
|
+
"lib0/dist/prng.cjs": "./dist/prng.cjs",
|
|
101
|
+
"lib0/prng": "./prng.js",
|
|
102
|
+
"lib0/promise.js": "./promise.js",
|
|
103
|
+
"lib0/dist/promise.cjs": "./dist/promise.cjs",
|
|
104
|
+
"lib0/promise": "./promise.js",
|
|
105
|
+
"lib0/queue.js": "./queue.js",
|
|
106
|
+
"lib0/dist/queue.cjs": "./dist/queue.cjs",
|
|
107
|
+
"lib0/queue": "./queue.js",
|
|
108
|
+
"lib0/random.js": "./random.js",
|
|
109
|
+
"lib0/dist/random.cjs": "./dist/random.cjs",
|
|
110
|
+
"lib0/random": "./random.js",
|
|
111
|
+
"lib0/set.js": "./set.js",
|
|
112
|
+
"lib0/dist/set.cjs": "./dist/set.cjs",
|
|
113
|
+
"lib0/set": "./set.js",
|
|
114
|
+
"lib0/sort.js": "./sort.js",
|
|
115
|
+
"lib0/dist/sort.cjs": "./dist/sort.cjs",
|
|
116
|
+
"lib0/sort": "./sort.js",
|
|
117
|
+
"lib0/statistics.js": "./statistics.js",
|
|
118
|
+
"lib0/dist/statistics.cjs": "./dist/statistics.cjs",
|
|
119
|
+
"lib0/statistics": "./statistics.js",
|
|
120
|
+
"lib0/storage.js": "./storage.js",
|
|
121
|
+
"lib0/dist/storage.cjs": "./dist/storage.cjs",
|
|
122
|
+
"lib0/storage": "./storage.js",
|
|
123
|
+
"lib0/string.js": "./string.js",
|
|
124
|
+
"lib0/dist/string.cjs": "./dist/string.cjs",
|
|
125
|
+
"lib0/string": "./string.js",
|
|
126
|
+
"lib0/symbol.js": "./symbol.js",
|
|
127
|
+
"lib0/dist/symbol.cjs": "./dist/symbol.cjs",
|
|
128
|
+
"lib0/symbol": "./symbol.js",
|
|
129
|
+
"lib0/testing.js": "./testing.js",
|
|
130
|
+
"lib0/dist/testing.cjs": "./dist/testing.cjs",
|
|
131
|
+
"lib0/testing": "./testing.js",
|
|
132
|
+
"lib0/time.js": "./time.js",
|
|
133
|
+
"lib0/dist/time.cjs": "./dist/time.cjs",
|
|
134
|
+
"lib0/time": "./time.js",
|
|
135
|
+
"lib0/tree.js": "./tree.js",
|
|
136
|
+
"lib0/dist/tree.cjs": "./dist/tree.cjs",
|
|
137
|
+
"lib0/tree": "./tree.js",
|
|
138
|
+
"lib0/url.js": "./url.js",
|
|
139
|
+
"lib0/dist/url.cjs": "./dist/url.cjs",
|
|
140
|
+
"lib0/url": "./url.js",
|
|
141
|
+
"lib0/websocket.js": "./websocket.js",
|
|
142
|
+
"lib0/dist/websocket.cjs": "./dist/websocket.cjs",
|
|
143
|
+
"lib0/websocket": "./websocket.js",
|
|
144
|
+
"lib0/webcrypto": "./webcrypto.browser.js",
|
|
145
|
+
"isomorphic.js": "./node_modules/isomorphic.js/browser.mjs",
|
|
146
|
+
"isomorphic.js/package.json": "./node_modules/isomorphic.js/package.json"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
5
150
|
</head>
|
|
6
151
|
<body>
|
|
7
|
-
<script type="module" src="./
|
|
152
|
+
<script type="module" src="./test.js"></script>
|
|
8
153
|
</body>
|
|
9
|
-
</html>
|
|
154
|
+
</html>
|
|
155
|
+
|
package/test.js
CHANGED
|
@@ -31,10 +31,11 @@ import * as func from './function.test.js'
|
|
|
31
31
|
import * as storage from './storage.test.js'
|
|
32
32
|
import * as list from './list.test.js'
|
|
33
33
|
import * as cache from './cache.test.js'
|
|
34
|
+
import * as symbol from './symbol.test.js'
|
|
34
35
|
|
|
35
36
|
import { isBrowser, isNode } from './environment.js'
|
|
36
37
|
|
|
37
|
-
/*
|
|
38
|
+
/* c8 ignore next */
|
|
38
39
|
if (isBrowser) {
|
|
39
40
|
log.createVConsole(document.body)
|
|
40
41
|
}
|
|
@@ -70,9 +71,10 @@ runTests({
|
|
|
70
71
|
func,
|
|
71
72
|
storage,
|
|
72
73
|
list,
|
|
73
|
-
cache
|
|
74
|
+
cache,
|
|
75
|
+
symbol
|
|
74
76
|
}).then(success => {
|
|
75
|
-
/*
|
|
77
|
+
/* c8 ignore next */
|
|
76
78
|
if (isNode) {
|
|
77
79
|
process.exit(success ? 0 : 1)
|
|
78
80
|
}
|
package/testing.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export function compareArrays<T>(as: T[], bs: T[], m?: string | undefined): bool
|
|
|
43
43
|
export function compareStrings(a: string, b: string, m?: string | undefined): void;
|
|
44
44
|
export function compareObjects<K, V>(a: any, b: any, m?: string | undefined): void;
|
|
45
45
|
export function compare<T>(a: T, b: T, message?: string | null | undefined, customCompare?: ((arg0: any, arg1: T, arg2: T, arg3: string, arg4: any) => boolean) | undefined): boolean;
|
|
46
|
-
export function assert(
|
|
46
|
+
export function assert<T>(property: T, message?: string | null | undefined): asserts property is NonNullable<T>;
|
|
47
47
|
export function promiseRejected(f: () => Promise<any>): Promise<void>;
|
|
48
48
|
export function fails(f: () => void): void;
|
|
49
49
|
export function runTests(tests: {
|
package/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["testing.js"],"names":[],"mappings":";AA+DA,gCAAiD;AAGjD,oCAAmG;AAEnG;IACE;;;OAGG;IACH,wBAHW,MAAM,YACN,MAAM,EAahB;IAVC;;OAEG;IACH,YAFU,MAAM,CAEY;IAC5B;;OAEG;IACH,UAFU,MAAM,CAEQ;IACxB,qBAAiB;IACjB,wBAAiB;IAGnB,kBAGC;IAED;;OAEG;IAEH,mBAOC;IAED;;;;OAIG;IACH,sBAMC;CACF;AAED,oCAA6E;AAgBtE,gCANI,MAAM,QACN,MAAM,YACG,QAAQ,KAAE,IAAI,GAAC,QAAQ,GAAG,CAAC,KACpC,MAAM,iBACN,MAAM,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["testing.js"],"names":[],"mappings":";AA+DA,gCAAiD;AAGjD,oCAAmG;AAEnG;IACE;;;OAGG;IACH,wBAHW,MAAM,YACN,MAAM,EAahB;IAVC;;OAEG;IACH,YAFU,MAAM,CAEY;IAC5B;;OAEG;IACH,UAFU,MAAM,CAEQ;IACxB,qBAAiB;IACjB,wBAAiB;IAGnB,kBAGC;IAED;;OAEG;IAEH,mBAOC;IAED;;;;OAIG;IACH,sBAMC;CACF;AAED,oCAA6E;AAgBtE,gCANI,MAAM,QACN,MAAM,YACG,QAAQ,KAAE,IAAI,GAAC,QAAQ,GAAG,CAAC,KACpC,MAAM,iBACN,MAAM,oBA0EhB;AAcM,sCAHI,MAAM,SACN,MAAM,QAEwF;AAYlG,2BAFI,MAAM,QAE6B;AAE9C,wDAAoC;AAEpC,8EAA0C;AAoBnC,mCAHI,MAAM,YACG,IAAI,KAAE,IAAI,QAS7B;AAoBM,wCAHI,MAAM,YACG,IAAI,KAAE,QAAQ,GAAG,CAAC,iBASrC;AAoBM,qCAJI,MAAM,WACK,IAAI,GACd,MAAM,CAYjB;AAoBM,0CAJI,MAAM,WACK,QAAQ,GAAG,CAAC,GACtB,QAAQ,MAAM,CAAC,CAY1B;AASM,4EAFK,OAAO,CAYlB;AAQM,kCALI,MAAM,KACN,MAAM,gCAUhB;AASM,mFAA2F;AAsH3F,oGAFa,GAAG,0BAAK,MAAM,QAAC,GAAG,KAAE,OAAO,wBAE8E;AAUtH,gHAA8H;AAK9H,yCAFe,QAAQ,GAAG,CAAC,iBASjC;AAMM,+BAHe,IAAI,QAWzB;AAKM;QAFW,MAAM;YAAS,MAAM,UAAW,QAAQ,KAAE,IAAI,GAAC,QAAQ,GAAG,CAAC;;qBA2C5E;AAQM,6BAHI,MAAM,SAMhB;AAQM,4BAHI,OAAO,QAOjB"}
|
package/testing.js
CHANGED
|
@@ -63,7 +63,7 @@ export { production } from './environment.js'
|
|
|
63
63
|
|
|
64
64
|
export const extensive = env.hasConf('extensive')
|
|
65
65
|
|
|
66
|
-
/*
|
|
66
|
+
/* c8 ignore next */
|
|
67
67
|
export const envSeed = env.hasParam('--seed') ? Number.parseInt(env.getParam('--seed', '0')) : null
|
|
68
68
|
|
|
69
69
|
export class TestCase {
|
|
@@ -92,11 +92,11 @@ export class TestCase {
|
|
|
92
92
|
/**
|
|
93
93
|
* @type {number}
|
|
94
94
|
*/
|
|
95
|
-
/*
|
|
95
|
+
/* c8 ignore next */
|
|
96
96
|
get seed () {
|
|
97
|
-
/*
|
|
97
|
+
/* c8 ignore else */
|
|
98
98
|
if (this._seed === null) {
|
|
99
|
-
/*
|
|
99
|
+
/* c8 ignore next */
|
|
100
100
|
this._seed = envSeed === null ? random.uint32() : envSeed
|
|
101
101
|
}
|
|
102
102
|
return this._seed
|
|
@@ -108,7 +108,7 @@ export class TestCase {
|
|
|
108
108
|
* @type {prng.PRNG}
|
|
109
109
|
*/
|
|
110
110
|
get prng () {
|
|
111
|
-
/*
|
|
111
|
+
/* c8 ignore else */
|
|
112
112
|
if (this._prng === null) {
|
|
113
113
|
this._prng = prng.create(this.seed)
|
|
114
114
|
}
|
|
@@ -117,10 +117,10 @@ export class TestCase {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export const repetitionTime = Number(env.getParam('--repetition-time', '50'))
|
|
120
|
-
/*
|
|
120
|
+
/* c8 ignore next */
|
|
121
121
|
const testFilter = env.hasParam('--filter') ? env.getParam('--filter', '') : null
|
|
122
122
|
|
|
123
|
-
/*
|
|
123
|
+
/* c8 ignore next */
|
|
124
124
|
const testFilterRegExp = testFilter !== null ? new RegExp(testFilter) : new RegExp('.*')
|
|
125
125
|
|
|
126
126
|
const repeatTestRegex = /^(repeat|repeating)\s/
|
|
@@ -135,14 +135,14 @@ const repeatTestRegex = /^(repeat|repeating)\s/
|
|
|
135
135
|
export const run = async (moduleName, name, f, i, numberOfTests) => {
|
|
136
136
|
const uncamelized = string.fromCamelCase(name.slice(4), ' ')
|
|
137
137
|
const filtered = !testFilterRegExp.test(`[${i + 1}/${numberOfTests}] ${moduleName}: ${uncamelized}`)
|
|
138
|
-
/*
|
|
138
|
+
/* c8 ignore next 3 */
|
|
139
139
|
if (filtered) {
|
|
140
140
|
return true
|
|
141
141
|
}
|
|
142
142
|
const tc = new TestCase(moduleName, name)
|
|
143
143
|
const repeat = repeatTestRegex.test(uncamelized)
|
|
144
144
|
const groupArgs = [log.GREY, `[${i + 1}/${numberOfTests}] `, log.PURPLE, `${moduleName}: `, log.BLUE, uncamelized]
|
|
145
|
-
/*
|
|
145
|
+
/* c8 ignore next 5 */
|
|
146
146
|
if (testFilter === null) {
|
|
147
147
|
log.groupCollapsed(...groupArgs)
|
|
148
148
|
} else {
|
|
@@ -175,7 +175,7 @@ export const run = async (moduleName, name, f, i, numberOfTests) => {
|
|
|
175
175
|
}
|
|
176
176
|
} while (err === null && (lastTime - start) < repetitionTime)
|
|
177
177
|
performance.mark(`${name}-end`)
|
|
178
|
-
/*
|
|
178
|
+
/* c8 ignore next 3 */
|
|
179
179
|
if (err !== null && err.constructor !== SkipError) {
|
|
180
180
|
log.printError(err)
|
|
181
181
|
}
|
|
@@ -184,7 +184,7 @@ export const run = async (moduleName, name, f, i, numberOfTests) => {
|
|
|
184
184
|
const duration = lastTime - start
|
|
185
185
|
let success = true
|
|
186
186
|
times.sort((a, b) => a - b)
|
|
187
|
-
/*
|
|
187
|
+
/* c8 ignore next 3 */
|
|
188
188
|
const againMessage = env.isBrowser
|
|
189
189
|
? ` - ${window.location.host + window.location.pathname}?filter=\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}`
|
|
190
190
|
: `\nrepeat: npm run test -- --filter "\\[${i + 1}/" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`
|
|
@@ -192,13 +192,14 @@ export const run = async (moduleName, name, f, i, numberOfTests) => {
|
|
|
192
192
|
? ` - ${times.length} repetitions in ${time.humanizeDuration(duration)} (best: ${time.humanizeDuration(times[0])}, worst: ${time.humanizeDuration(array.last(times))}, median: ${time.humanizeDuration(statistics.median(times))}, average: ${time.humanizeDuration(statistics.average(times))})`
|
|
193
193
|
: ` in ${time.humanizeDuration(duration)}`
|
|
194
194
|
if (err !== null) {
|
|
195
|
-
/*
|
|
195
|
+
/* c8 ignore start */
|
|
196
196
|
if (err.constructor === SkipError) {
|
|
197
197
|
log.print(log.GREY, log.BOLD, 'Skipped: ', log.UNBOLD, uncamelized)
|
|
198
198
|
} else {
|
|
199
199
|
success = false
|
|
200
200
|
log.print(log.RED, log.BOLD, 'Failure: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage)
|
|
201
201
|
}
|
|
202
|
+
/* c8 ignore stop */
|
|
202
203
|
} else {
|
|
203
204
|
log.print(log.GREEN, log.BOLD, 'Success: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage)
|
|
204
205
|
}
|
|
@@ -490,7 +491,7 @@ const _compare = (a, b, path, message, customCompare) => {
|
|
|
490
491
|
// @ts-ignore
|
|
491
492
|
a.forEach((value, i) => _compare(value, b[i], `${path}[${i}]`, message, customCompare))
|
|
492
493
|
break
|
|
493
|
-
/*
|
|
494
|
+
/* c8 ignore next 4 */
|
|
494
495
|
default:
|
|
495
496
|
if (!customCompare(a.constructor, a, b, path, compareValues)) {
|
|
496
497
|
_failMessage(message, `Values ${json.stringify(a)} and ${json.stringify(b)} don't match`, path)
|
|
@@ -509,13 +510,15 @@ const _compare = (a, b, path, message, customCompare) => {
|
|
|
509
510
|
*/
|
|
510
511
|
export const compare = (a, b, message = null, customCompare = compareValues) => _compare(a, b, 'obj', message, customCompare)
|
|
511
512
|
|
|
512
|
-
/* istanbul ignore next */
|
|
513
513
|
/**
|
|
514
|
-
* @
|
|
514
|
+
* @template T
|
|
515
|
+
* @param {T} property
|
|
515
516
|
* @param {string?} [message]
|
|
517
|
+
* @return {asserts property is NonNullable<T>}
|
|
516
518
|
* @throws {TestError}
|
|
517
519
|
*/
|
|
518
|
-
|
|
520
|
+
/* c8 ignore next */
|
|
521
|
+
export const assert = (property, message = null) => { property || fail(`Assertion failed${message !== null ? `: ${message}` : ''}`) }
|
|
519
522
|
|
|
520
523
|
/**
|
|
521
524
|
* @param {function():Promise<any>} f
|
|
@@ -551,7 +554,7 @@ export const runTests = async tests => {
|
|
|
551
554
|
* @param {string} testname
|
|
552
555
|
*/
|
|
553
556
|
const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark')
|
|
554
|
-
const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /*
|
|
557
|
+
const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /* c8 ignore next */ f && filterTest(fname) ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0)
|
|
555
558
|
let successfulTests = 0
|
|
556
559
|
let testnumber = 0
|
|
557
560
|
const start = performance.now()
|
|
@@ -559,7 +562,7 @@ export const runTests = async tests => {
|
|
|
559
562
|
const mod = tests[modName]
|
|
560
563
|
for (const fname in mod) {
|
|
561
564
|
const f = mod[fname]
|
|
562
|
-
/*
|
|
565
|
+
/* c8 ignore else */
|
|
563
566
|
if (f && filterTest(fname)) {
|
|
564
567
|
const repeatEachTest = 1
|
|
565
568
|
let success = true
|
|
@@ -567,7 +570,7 @@ export const runTests = async tests => {
|
|
|
567
570
|
success = await run(modName, fname, f, testnumber, numberOfTests)
|
|
568
571
|
}
|
|
569
572
|
testnumber++
|
|
570
|
-
/*
|
|
573
|
+
/* c8 ignore else */
|
|
571
574
|
if (success) {
|
|
572
575
|
successfulTests++
|
|
573
576
|
}
|
|
@@ -577,16 +580,15 @@ export const runTests = async tests => {
|
|
|
577
580
|
const end = performance.now()
|
|
578
581
|
log.print('')
|
|
579
582
|
const success = successfulTests === numberOfTests
|
|
580
|
-
/*
|
|
583
|
+
/* c8 ignore start */
|
|
581
584
|
if (success) {
|
|
582
|
-
/* istanbul ignore next */
|
|
583
585
|
log.print(log.GREEN, log.BOLD, 'All tests successful!', log.GREY, log.UNBOLD, ` in ${time.humanizeDuration(end - start)}`)
|
|
584
|
-
/* istanbul ignore next */
|
|
585
586
|
log.printImgBase64(nyanCatImage, 50)
|
|
586
587
|
} else {
|
|
587
588
|
const failedTests = numberOfTests - successfulTests
|
|
588
589
|
log.print(log.RED, log.BOLD, `> ${failedTests} test${failedTests > 1 ? 's' : ''} failed`)
|
|
589
590
|
}
|
|
591
|
+
/* c8 ignore stop */
|
|
590
592
|
return success
|
|
591
593
|
}
|
|
592
594
|
|
package/testing.test.d.ts
CHANGED
package/testing.test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.test.d.ts","sourceRoot":"","sources":["testing.test.js"],"names":[],"mappings":"AAQO,4CAEN;AAKM,mCAFI,EAAE,QAAQ,QA+FpB;AAEM,6CAWN;AAEM,qCAMN;AAEM,2CAIN;AAEM,6CAON"}
|
|
1
|
+
{"version":3,"file":"testing.test.d.ts","sourceRoot":"","sources":["testing.test.js"],"names":[],"mappings":"AAQO,4CAEN;AAEM,yCAMN;AAKM,mCAFI,EAAE,QAAQ,QA+FpB;AAEM,6CAWN;AAEM,qCAMN;AAEM,2CAIN;AAEM,6CAON"}
|
package/time.js
CHANGED
|
@@ -41,7 +41,7 @@ export const humanizeDuration = d => {
|
|
|
41
41
|
return days + 'd' + ((hours > 0 || minutes > 30) ? ' ' + (minutes > 30 ? hours + 1 : hours) + 'h' : '')
|
|
42
42
|
}
|
|
43
43
|
if (hours > 0) {
|
|
44
|
-
/*
|
|
44
|
+
/* c8 ignore next */
|
|
45
45
|
return hours + 'h' + ((minutes > 0 || seconds > 30) ? ' ' + (seconds > 30 ? minutes + 1 : minutes) + 'min' : '')
|
|
46
46
|
}
|
|
47
47
|
return minutes + 'min' + (seconds > 0 ? ' ' + seconds + 's' : '')
|
package/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["tree.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["tree.js"],"names":[],"mappings":"AAiJA;;;;GAIG;AACH;IAEI,UAAgB;IAChB,eAAe;IAGjB;;OAEG;IACH,aAFW,CAAC,KAMX;IAED;;OAEG;IACH,aAFW,CAAC,KAMX;IAED;;OAEG;IACH,6BAFW,CAAC,OA0BX;IAED;;OAEG;IACH,2BAFW,CAAC,OA6BX;IAED;;OAEG;IACH,oBAFY,CAAC,CAQZ;IAED;;;OAGG;IACH,yBAHW,CAAC,GACA,CAAC,CAKZ;IAED;;;OAGG;IACH,uBAHW,CAAC,GACA,CAAC,CAKZ;IAED;;;;OAIG;IACH,cAJW,CAAC,qBAEQ,CAAC,KAAE,IAAI,QAoB1B;IAED;;;OAGG;IACH,SAHW,CAAC,GACA,CAAC,GAAC,IAAI,CASjB;IAED;;;OAGG;IACH,aAHW,CAAC,GACA,EAAE,CAAC,CAAC,GAAC,IAAI,CAoBpB;IAED;;OAEG;IACH,WAFW,CAAC,QAmEX;IAED,yBAmEC;IAED,iBA+BC;IAED,yBA8CC;CACF;AA7gBD;;GAEG;AACH;IACE;;;;OAIG;IACH,iBAFW,CAAC,EAQX;IALC,OAAc;IACd,eAAiB;IACjB,WAAiB;IACjB,YAAkB;IAClB,aAAmB;IAGrB,iBAA8B;IAC9B,mBAAiC;IACjC,eAA4C;IAC5C,gBAA8C;IAC9C,uBAEC;IAED,kBAEC;IAED,mBAIC;IAUD,mBAKC;IAbD,gBAEC;IAaD,oBAKC;IAhBD,iBAEC;IAgBD,4BAOC;IAED,YAeC;IAED,YAeC;IAED,6BAOC;IAED,gBAOC;CACF"}
|
package/tree.js
CHANGED
|
@@ -49,7 +49,8 @@ class N {
|
|
|
49
49
|
|
|
50
50
|
get sibling () {
|
|
51
51
|
return (this === this.parent.left)
|
|
52
|
-
? this.parent.right
|
|
52
|
+
? this.parent.right
|
|
53
|
+
: this.parent.left
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
get left () {
|
|
@@ -86,13 +87,13 @@ class N {
|
|
|
86
87
|
next () {
|
|
87
88
|
if (this.right !== null) {
|
|
88
89
|
// search the most left node in the right tree
|
|
89
|
-
|
|
90
|
+
let o = this.right
|
|
90
91
|
while (o.left !== null) {
|
|
91
92
|
o = o.left
|
|
92
93
|
}
|
|
93
94
|
return o
|
|
94
95
|
} else {
|
|
95
|
-
|
|
96
|
+
let p = this
|
|
96
97
|
while (p.parent !== null && p !== p.parent.left) {
|
|
97
98
|
p = p.parent
|
|
98
99
|
}
|
|
@@ -103,13 +104,13 @@ class N {
|
|
|
103
104
|
prev () {
|
|
104
105
|
if (this.left !== null) {
|
|
105
106
|
// search the most right node in the left tree
|
|
106
|
-
|
|
107
|
+
let o = this.left
|
|
107
108
|
while (o.right !== null) {
|
|
108
109
|
o = o.right
|
|
109
110
|
}
|
|
110
111
|
return o
|
|
111
112
|
} else {
|
|
112
|
-
|
|
113
|
+
let p = this
|
|
113
114
|
while (p.parent !== null && p !== p.parent.right) {
|
|
114
115
|
p = p.parent
|
|
115
116
|
}
|
|
@@ -157,7 +158,7 @@ export class Tree {
|
|
|
157
158
|
* @param {K} id
|
|
158
159
|
*/
|
|
159
160
|
findNext (id) {
|
|
160
|
-
|
|
161
|
+
const nextID = id.clone()
|
|
161
162
|
nextID.clock += 1
|
|
162
163
|
return this.findWithLowerBound(nextID)
|
|
163
164
|
}
|
|
@@ -175,7 +176,7 @@ export class Tree {
|
|
|
175
176
|
* @param {K} from
|
|
176
177
|
*/
|
|
177
178
|
findNodeWithLowerBound (from) {
|
|
178
|
-
|
|
179
|
+
let o = this.root
|
|
179
180
|
if (o === null) {
|
|
180
181
|
return null
|
|
181
182
|
} else {
|
|
@@ -207,7 +208,7 @@ export class Tree {
|
|
|
207
208
|
if (to === undefined) {
|
|
208
209
|
throw new Error('You must define from!')
|
|
209
210
|
}
|
|
210
|
-
|
|
211
|
+
let o = this.root
|
|
211
212
|
if (o === null) {
|
|
212
213
|
return null
|
|
213
214
|
} else {
|
|
@@ -236,7 +237,7 @@ export class Tree {
|
|
|
236
237
|
* @return {V}
|
|
237
238
|
*/
|
|
238
239
|
findSmallestNode () {
|
|
239
|
-
|
|
240
|
+
let o = this.root
|
|
240
241
|
while (o != null && o.left != null) {
|
|
241
242
|
o = o.left
|
|
242
243
|
}
|
|
@@ -248,7 +249,7 @@ export class Tree {
|
|
|
248
249
|
* @return {V}
|
|
249
250
|
*/
|
|
250
251
|
findWithLowerBound (from) {
|
|
251
|
-
|
|
252
|
+
const n = this.findNodeWithLowerBound(from)
|
|
252
253
|
return n == null ? null : n.val
|
|
253
254
|
}
|
|
254
255
|
|
|
@@ -257,7 +258,7 @@ export class Tree {
|
|
|
257
258
|
* @return {V}
|
|
258
259
|
*/
|
|
259
260
|
findWithUpperBound (to) {
|
|
260
|
-
|
|
261
|
+
const n = this.findNodeWithUpperBound(to)
|
|
261
262
|
return n == null ? null : n.val
|
|
262
263
|
}
|
|
263
264
|
|
|
@@ -267,7 +268,7 @@ export class Tree {
|
|
|
267
268
|
* @param {function(V):void} f
|
|
268
269
|
*/
|
|
269
270
|
iterate (from, to, f) {
|
|
270
|
-
|
|
271
|
+
let o
|
|
271
272
|
if (from === null) {
|
|
272
273
|
o = this.findSmallestNode()
|
|
273
274
|
} else {
|
|
@@ -304,7 +305,7 @@ export class Tree {
|
|
|
304
305
|
* @return {N<V>|null}
|
|
305
306
|
*/
|
|
306
307
|
findNode (id) {
|
|
307
|
-
|
|
308
|
+
let o = this.root
|
|
308
309
|
if (o === null) {
|
|
309
310
|
return null
|
|
310
311
|
} else {
|
|
@@ -327,7 +328,7 @@ export class Tree {
|
|
|
327
328
|
* @param {K} id
|
|
328
329
|
*/
|
|
329
330
|
delete (id) {
|
|
330
|
-
|
|
331
|
+
let d = this.findNode(id)
|
|
331
332
|
if (d == null) {
|
|
332
333
|
// throw new Error('Element does not exist!')
|
|
333
334
|
return
|
|
@@ -336,7 +337,7 @@ export class Tree {
|
|
|
336
337
|
if (d.left !== null && d.right !== null) {
|
|
337
338
|
// switch d with the greates element in the left subtree.
|
|
338
339
|
// o should have at most one child.
|
|
339
|
-
|
|
340
|
+
let o = d.left
|
|
340
341
|
// find
|
|
341
342
|
while (o.right !== null) {
|
|
342
343
|
o = o.right
|
|
@@ -347,8 +348,8 @@ export class Tree {
|
|
|
347
348
|
}
|
|
348
349
|
// d has at most one child
|
|
349
350
|
// let n be the node that replaces d
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
let isFakeChild
|
|
352
|
+
let child = d.left || d.right
|
|
352
353
|
if (child === null) {
|
|
353
354
|
isFakeChild = true
|
|
354
355
|
child = new N(null)
|
|
@@ -401,7 +402,7 @@ export class Tree {
|
|
|
401
402
|
// d was already replaced by the child
|
|
402
403
|
// d is not the root
|
|
403
404
|
// d and child are black
|
|
404
|
-
|
|
405
|
+
let sibling = n.sibling
|
|
405
406
|
if (isRed(sibling)) {
|
|
406
407
|
// make sibling the grandfather
|
|
407
408
|
n.parent.redden()
|
|
@@ -463,9 +464,9 @@ export class Tree {
|
|
|
463
464
|
}
|
|
464
465
|
|
|
465
466
|
put (v) {
|
|
466
|
-
|
|
467
|
+
const node = new N(v)
|
|
467
468
|
if (this.root !== null) {
|
|
468
|
-
|
|
469
|
+
let p = this.root // p abbrev. parent
|
|
469
470
|
while (true) {
|
|
470
471
|
if (node.val._id.lessThan(p.val._id)) {
|
|
471
472
|
if (p.left === null) {
|
|
@@ -502,7 +503,7 @@ export class Tree {
|
|
|
502
503
|
} else if (n.parent.isBlack()) {
|
|
503
504
|
return
|
|
504
505
|
}
|
|
505
|
-
|
|
506
|
+
const uncle = n.getUncle()
|
|
506
507
|
if (uncle !== null && uncle.isRed()) {
|
|
507
508
|
// Note: parent: red, uncle: red
|
|
508
509
|
n.parent.blacken()
|
package/url.js
CHANGED
|
@@ -19,7 +19,7 @@ export const decodeQueryParams = url => {
|
|
|
19
19
|
const query = {}
|
|
20
20
|
const urlQuerySplit = url.split('?')
|
|
21
21
|
const pairs = urlQuerySplit[urlQuerySplit.length - 1].split('&')
|
|
22
|
-
for (
|
|
22
|
+
for (let i = 0; i < pairs.length; i++) {
|
|
23
23
|
const item = pairs[i]
|
|
24
24
|
if (item.length > 0) {
|
|
25
25
|
const pair = item.split('=')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webcrypto.deno.d.ts","sourceRoot":"","sources":["webcrypto.deno.js"],"names":[],"mappings":"AACA,yBAAwD;AAExD,kCAAuF"}
|