@thi.ng/zipper 2.1.11 → 2.1.12
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/CHANGELOG.md +1 -1
- package/package.json +7 -7
- package/bench/index.js +0 -41
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/zipper",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.12",
|
|
4
4
|
"description": "Functional tree editing, manipulation & navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.3.
|
|
38
|
-
"@thi.ng/arrays": "^2.3.
|
|
39
|
-
"@thi.ng/checks": "^3.2.
|
|
40
|
-
"@thi.ng/errors": "^2.1.
|
|
37
|
+
"@thi.ng/api": "^8.3.9",
|
|
38
|
+
"@thi.ng/arrays": "^2.3.2",
|
|
39
|
+
"@thi.ng/checks": "^3.2.3",
|
|
40
|
+
"@thi.ng/errors": "^2.1.9"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@microsoft/api-extractor": "^7.25.0",
|
|
44
|
-
"@thi.ng/testament": "^0.2.
|
|
44
|
+
"@thi.ng/testament": "^0.2.10",
|
|
45
45
|
"rimraf": "^3.0.2",
|
|
46
46
|
"tools": "^0.0.1",
|
|
47
47
|
"typedoc": "^0.22.17",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
],
|
|
95
95
|
"year": 2015
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "976ccd698cedaa60dcef2e69030a5eb98898cc4a\n"
|
|
98
98
|
}
|
package/bench/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const tx = require("@thi.ng/transducers");
|
|
2
|
-
const b = require("@thi.ng/bench");
|
|
3
|
-
const arrayZipper = require("@thi.ng/zipper").arrayZipper;
|
|
4
|
-
const isNumber = require("@thi.ng/checks").isNumber;
|
|
5
|
-
|
|
6
|
-
const src = [...tx.repeat([...tx.repeat([...tx.range(10)], 10)], 10)];
|
|
7
|
-
|
|
8
|
-
const walk = (loc) => {
|
|
9
|
-
let sum = 0;
|
|
10
|
-
for (;;) {
|
|
11
|
-
if (!loc) return sum;
|
|
12
|
-
const n = loc.node;
|
|
13
|
-
if (isNumber(n)) sum += n;
|
|
14
|
-
loc = loc.next;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const mul10 = (x) => x * 10;
|
|
19
|
-
|
|
20
|
-
const edit = (loc) => {
|
|
21
|
-
for (;;) {
|
|
22
|
-
if (isNumber(loc.node)) loc = loc.update(mul10);
|
|
23
|
-
const lnext = loc.next;
|
|
24
|
-
if (!lnext) return loc.root;
|
|
25
|
-
loc = lnext;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const benchmark = (fn, iter = 1e4) => {
|
|
30
|
-
for (let i = 0; i < 3; i++) {
|
|
31
|
-
b.bench(fn, iter, "warmup... ");
|
|
32
|
-
}
|
|
33
|
-
const [_, t] = b.benchResult(fn, iter);
|
|
34
|
-
console.log(`total: ${t}ms, mean: ${t / iter}ms, runs: ${iter}`);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
console.log("walk:");
|
|
38
|
-
benchmark(() => walk(arrayZipper(src)));
|
|
39
|
-
|
|
40
|
-
console.log("\nedit:");
|
|
41
|
-
benchmark(() => edit(arrayZipper(src)));
|