@thi.ng/zipper 2.1.99 → 2.1.101
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 +11 -12
- package/zipper.js +11 -22
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.101",
|
|
4
4
|
"description": "Functional tree editing, manipulation & navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
28
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
29
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
30
|
-
"clean": "
|
|
30
|
+
"clean": "bun ../../tools/src/clean-package.ts",
|
|
31
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
32
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
33
33
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -36,17 +36,16 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/arrays": "^2.9.
|
|
41
|
-
"@thi.ng/checks": "^3.6.
|
|
42
|
-
"@thi.ng/errors": "^2.5.
|
|
39
|
+
"@thi.ng/api": "^8.11.2",
|
|
40
|
+
"@thi.ng/arrays": "^2.9.6",
|
|
41
|
+
"@thi.ng/checks": "^3.6.4",
|
|
42
|
+
"@thi.ng/errors": "^2.5.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.43.
|
|
46
|
-
"esbuild": "^0.
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"typescript": "^5.4.3"
|
|
45
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
46
|
+
"esbuild": "^0.21.1",
|
|
47
|
+
"typedoc": "^0.25.13",
|
|
48
|
+
"typescript": "^5.4.5"
|
|
50
49
|
},
|
|
51
50
|
"keywords": [
|
|
52
51
|
"adjacency",
|
|
@@ -95,5 +94,5 @@
|
|
|
95
94
|
],
|
|
96
95
|
"year": 2015
|
|
97
96
|
},
|
|
98
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
99
98
|
}
|
package/zipper.js
CHANGED
|
@@ -69,8 +69,7 @@ class Location {
|
|
|
69
69
|
get right() {
|
|
70
70
|
const path = this._path;
|
|
71
71
|
const rights = path && path.r;
|
|
72
|
-
if (!rights)
|
|
73
|
-
return;
|
|
72
|
+
if (!rights) return;
|
|
74
73
|
const r = rights.slice(1);
|
|
75
74
|
return new Location(
|
|
76
75
|
rights[0],
|
|
@@ -118,11 +117,9 @@ class Location {
|
|
|
118
117
|
) : this;
|
|
119
118
|
}
|
|
120
119
|
get down() {
|
|
121
|
-
if (!this.isBranch)
|
|
122
|
-
return;
|
|
120
|
+
if (!this.isBranch) return;
|
|
123
121
|
const children = this.children;
|
|
124
|
-
if (!children)
|
|
125
|
-
return;
|
|
122
|
+
if (!children) return;
|
|
126
123
|
const path = this._path;
|
|
127
124
|
const r = children.slice(1);
|
|
128
125
|
return new Location(
|
|
@@ -139,8 +136,7 @@ class Location {
|
|
|
139
136
|
get up() {
|
|
140
137
|
let path = this._path;
|
|
141
138
|
const pnodes = path && path.nodes;
|
|
142
|
-
if (!pnodes)
|
|
143
|
-
return;
|
|
139
|
+
if (!pnodes) return;
|
|
144
140
|
const pnode = peek(pnodes);
|
|
145
141
|
if (path.changed) {
|
|
146
142
|
return new Location(
|
|
@@ -161,29 +157,23 @@ class Location {
|
|
|
161
157
|
}
|
|
162
158
|
get prev() {
|
|
163
159
|
let node = this.left;
|
|
164
|
-
if (!node)
|
|
165
|
-
return this.up;
|
|
160
|
+
if (!node) return this.up;
|
|
166
161
|
while (true) {
|
|
167
162
|
const child = node.isBranch ? node.down : void 0;
|
|
168
|
-
if (!child)
|
|
169
|
-
return node;
|
|
163
|
+
if (!child) return node;
|
|
170
164
|
node = child.rightmost;
|
|
171
165
|
}
|
|
172
166
|
}
|
|
173
167
|
get next() {
|
|
174
|
-
if (this.isBranch)
|
|
175
|
-
return this.down;
|
|
168
|
+
if (this.isBranch) return this.down;
|
|
176
169
|
let right = this.right;
|
|
177
|
-
if (right)
|
|
178
|
-
return right;
|
|
170
|
+
if (right) return right;
|
|
179
171
|
let loc = this;
|
|
180
172
|
while (true) {
|
|
181
173
|
const up = loc.up;
|
|
182
|
-
if (!up)
|
|
183
|
-
return;
|
|
174
|
+
if (!up) return;
|
|
184
175
|
right = up.right;
|
|
185
|
-
if (right)
|
|
186
|
-
return right;
|
|
176
|
+
if (right) return right;
|
|
187
177
|
loc = up;
|
|
188
178
|
}
|
|
189
179
|
}
|
|
@@ -251,8 +241,7 @@ class Location {
|
|
|
251
241
|
);
|
|
252
242
|
while (true) {
|
|
253
243
|
const child = loc.isBranch ? loc.down : void 0;
|
|
254
|
-
if (!child)
|
|
255
|
-
return loc;
|
|
244
|
+
if (!child) return loc;
|
|
256
245
|
loc = child.rightmost;
|
|
257
246
|
}
|
|
258
247
|
}
|