@thi.ng/zipper 2.0.7 → 2.1.2

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 CHANGED
@@ -1,54 +1,87 @@
1
1
  # Change Log
2
2
 
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [2.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/zipper@2.0.6...@thi.ng/zipper@2.0.7) (2021-11-03)
3
+ - **Last updated**: 2021-11-21T17:09:28Z
4
+ - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
7
5
 
8
- **Note:** Version bump only for package @thi.ng/zipper
6
+ All notable changes to this project will be documented in this file.
7
+ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
9
8
 
9
+ **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
+ and/or version bumps of transitive dependencies.
10
11
 
12
+ ## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@2.1.0) (2021-11-17)
11
13
 
14
+ #### 🚀 Features
12
15
 
16
+ - Using workspaces for local tools ([bf7a404](https://github.com/thi-ng/umbrella/commit/bf7a404))
17
+ Improving the overall build ergonomics
18
+ - introduced a tools workspaces
19
+ - imported it in all needed packages/examples
20
+ - inclusive project root
13
21
 
14
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/zipper@1.0.3...@thi.ng/zipper@2.0.0) (2021-10-12)
22
+ #### ♻️ Refactoring
15
23
 
24
+ - testrunner to binary ([4ebbbb2](https://github.com/thi-ng/umbrella/commit/4ebbbb2))
25
+ this commit reverts (partly) changes made in:
26
+ ef346d7a8753590dc9094108a3d861a8dbd5dd2c
27
+ overall purpose is better testament ergonomics:
28
+ instead of having to pass NODE_OPTIONS with every invocation
29
+ having a binary to handle this for us.
16
30
 
17
- ### Build System
31
+ ### [2.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@2.0.1) (2021-10-13)
18
32
 
19
- * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
33
+ #### ♻️ Refactoring
20
34
 
35
+ - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
36
+ - update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
37
+ - add .js suffix for all relative imports
21
38
 
22
- ### BREAKING CHANGES
39
+ # [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@2.0.0) (2021-10-12)
23
40
 
24
- * discontinue CommonJS & UMD versions
41
+ #### 🛑 Breaking changes
25
42
 
26
- - only ESM modules will be published from now on
27
- - CJS obsolete due to ESM support in recent versions of node:
28
- - i.e. launch NodeJS via:
29
- - `node --experimental-specifier-resolution=node --experimental-repl-await`
30
- - in the node REPL use `await import(...)` instead of `require()`
31
- - UMD obsolete due to widespread browser support for ESM
43
+ - major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
44
+ - BREAKING CHANGE: discontinue CommonJS & UMD versions
45
+ - only ESM modules will be published from now on
46
+ - CJS obsolete due to ESM support in recent versions of node:
47
+ - i.e. launch NodeJS via:
48
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
49
+ - in the node REPL use `await import(...)` instead of `require()`
50
+ - UMD obsolete due to widespread browser support for ESM
51
+ Also:
52
+ - normalize/restructure/reorg all package.json files
53
+ - cleanup all build scripts, remove obsolete
54
+ - switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
32
55
 
33
- Also:
34
- - normalize/restructure/reorg all package.json files
35
- - cleanup all build scripts, remove obsolete
36
- - switch from mocha to @thi.ng/testament for all tests
56
+ #### ♻️ Refactoring
37
57
 
58
+ - update deps & imports in various pkgs ([e1cf29e](https://github.com/thi-ng/umbrella/commit/e1cf29e))
59
+ - largely related to recent updates/restructuring of these packages:
60
+ - api
61
+ - defmulti
62
+ - errors
63
+ - logger
64
+ - update imports ([138571a](https://github.com/thi-ng/umbrella/commit/138571a))
65
+ - update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
66
+ - update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
38
67
 
68
+ ### [0.1.46](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@0.1.46) (2021-06-08)
39
69
 
70
+ #### ♻️ Refactoring
40
71
 
72
+ - add missing type hints (TS4.3) ([030055d](https://github.com/thi-ng/umbrella/commit/030055d))
41
73
 
74
+ ### [0.1.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@0.1.3) (2020-02-25)
42
75
 
43
- ## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/zipper@1.0.2...@thi.ng/zipper@1.0.3) (2021-09-03)
76
+ #### ♻️ Refactoring
44
77
 
45
- **Note:** Version bump only for package @thi.ng/zipper
78
+ - update imports ([1fb1915](https://github.com/thi-ng/umbrella/commit/1fb1915))
46
79
 
47
- # 0.1.0 (2019-11-30)
80
+ ## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@0.1.0) (2019-11-30)
48
81
 
49
- ### Features
82
+ #### 🚀 Features
50
83
 
51
- - **zipper:** add .depth getter & tests ([65c5ec3](https://github.com/thi-ng/umbrella/commit/65c5ec30601b0229d6760854a8f1d817f4236b1d))
52
- - **zipper:** add update() & tests ([defdf76](https://github.com/thi-ng/umbrella/commit/defdf762b10350f0ce3e2b7d81f097c44f4e0223))
53
- - **zipper:** import new package (ported from clojure) ([5562fe4](https://github.com/thi-ng/umbrella/commit/5562fe47927e046e419e7c96ad9b2ef43e2eb818))
54
- - **zipper:** major refactor, add tests, update readme ([b91d8a6](https://github.com/thi-ng/umbrella/commit/b91d8a6047d30e4cddf10d1bfb0e929881ebfe34))
84
+ - add .depth getter & tests ([65c5ec3](https://github.com/thi-ng/umbrella/commit/65c5ec3))
85
+ - add update() & tests ([defdf76](https://github.com/thi-ng/umbrella/commit/defdf76))
86
+ - major refactor, add tests, update readme ([b91d8a6](https://github.com/thi-ng/umbrella/commit/b91d8a6))
87
+ - import new package (ported from clojure) ([5562fe4](https://github.com/thi-ng/umbrella/commit/5562fe4))
package/README.md CHANGED
@@ -71,7 +71,7 @@ node --experimental-repl-await
71
71
  > const zipper = await import("@thi.ng/zipper");
72
72
  ```
73
73
 
74
- Package sizes (gzipped, pre-treeshake): ESM: 1.02 KB
74
+ Package sizes (gzipped, pre-treeshake): ESM: 1.01 KB
75
75
 
76
76
  ## Dependencies
77
77
 
package/bench/index.js ADDED
@@ -0,0 +1,41 @@
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)));
package/package.json CHANGED
@@ -1,93 +1,98 @@
1
1
  {
2
- "name": "@thi.ng/zipper",
3
- "version": "2.0.7",
4
- "description": "Functional tree editing, manipulation & navigation",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
2
+ "name": "@thi.ng/zipper",
3
+ "version": "2.1.2",
4
+ "description": "Functional tree editing, manipulation & navigation",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/zipper#readme",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
12
18
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/zipper#readme",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- }
23
- ],
24
- "author": "Karsten Schmidt <k+npm@thi.ng>",
25
- "license": "Apache-2.0",
26
- "scripts": {
27
- "build": "yarn clean && tsc --declaration",
28
- "clean": "rimraf *.js *.d.ts *.map doc",
29
- "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
- "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
- "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
- "pub": "yarn build && yarn publish --access public",
34
- "test": "testament test"
35
- },
36
- "dependencies": {
37
- "@thi.ng/api": "^8.1.0",
38
- "@thi.ng/arrays": "^2.0.7",
39
- "@thi.ng/checks": "^3.0.6",
40
- "@thi.ng/errors": "^2.0.6"
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ }
23
+ ],
24
+ "author": "Karsten Schmidt <k+npm@thi.ng>",
25
+ "license": "Apache-2.0",
26
+ "scripts": {
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
+ "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
+ "doc:readme": "yarn doc:stats && tools:readme",
32
+ "doc:stats": "tools:module-stats",
33
+ "pub": "yarn npm publish --access public",
34
+ "test": "testament test"
35
+ },
36
+ "dependencies": {
37
+ "@thi.ng/api": "^8.3.2",
38
+ "@thi.ng/arrays": "^2.1.2",
39
+ "@thi.ng/checks": "^3.1.2",
40
+ "@thi.ng/errors": "^2.1.2"
41
+ },
42
+ "devDependencies": {
43
+ "@microsoft/api-extractor": "^7.18.19",
44
+ "@thi.ng/testament": "^0.2.2",
45
+ "rimraf": "^3.0.2",
46
+ "tools": "^0.0.1",
47
+ "typedoc": "^0.22.9",
48
+ "typescript": "^4.5.2"
49
+ },
50
+ "keywords": [
51
+ "adjacency",
52
+ "agent",
53
+ "array",
54
+ "clojure",
55
+ "datastructure",
56
+ "edit",
57
+ "functional",
58
+ "immutable",
59
+ "navigation",
60
+ "tree",
61
+ "typescript",
62
+ "zipper"
63
+ ],
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "engines": {
68
+ "node": ">=12.7"
69
+ },
70
+ "files": [
71
+ "*.js",
72
+ "*.d.ts"
73
+ ],
74
+ "exports": {
75
+ ".": {
76
+ "import": "./index.js"
41
77
  },
42
- "devDependencies": {
43
- "@thi.ng/testament": "^0.1.6"
78
+ "./api": {
79
+ "import": "./api.js"
44
80
  },
45
- "keywords": [
46
- "adjacency",
47
- "agent",
48
- "array",
49
- "clojure",
50
- "datastructure",
51
- "edit",
52
- "functional",
53
- "immutable",
54
- "navigation",
55
- "tree",
56
- "typescript",
57
- "zipper"
81
+ "./zipper": {
82
+ "import": "./zipper.js"
83
+ }
84
+ },
85
+ "thi.ng": {
86
+ "blog": [
87
+ {
88
+ "title": "Evolutionary failures (Part 1)",
89
+ "url": "https://medium.com/@thi.ng/evolutionary-failures-part-1-54522c69be37"
90
+ }
58
91
  ],
59
- "publishConfig": {
60
- "access": "public"
61
- },
62
- "engines": {
63
- "node": ">=12.7"
64
- },
65
- "files": [
66
- "*.js",
67
- "*.d.ts"
92
+ "related": [
93
+ "gp"
68
94
  ],
69
- "exports": {
70
- ".": {
71
- "import": "./index.js"
72
- },
73
- "./api": {
74
- "import": "./api.js"
75
- },
76
- "./zipper": {
77
- "import": "./zipper.js"
78
- }
79
- },
80
- "thi.ng": {
81
- "blog": [
82
- {
83
- "title": "Evolutionary failures (Part 1)",
84
- "url": "https://medium.com/@thi.ng/evolutionary-failures-part-1-54522c69be37"
85
- }
86
- ],
87
- "related": [
88
- "gp"
89
- ],
90
- "year": 2015
91
- },
92
- "gitHead": "852cd2450617c86d15d18477dc634f17f04202eb"
93
- }
95
+ "year": 2015
96
+ },
97
+ "gitHead": "e8a7c2a40191b391cef182c2978e5a6c85987a87\n"
98
+ }