@thi.ng/zipper 2.1.101 → 2.1.102
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 +8 -1
- package/README.md +1 -1
- package/package.json +10 -10
- package/zipper.d.ts +1 -1
- package/zipper.js +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [2.1.102](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@2.1.102) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
|
|
17
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
18
|
+
|
|
12
19
|
### [2.1.99](https://github.com/thi-ng/umbrella/tree/@thi.ng/zipper@2.1.99) (2024-04-20)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/zipper",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.102",
|
|
4
4
|
"description": "Functional tree editing, manipulation & navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/zipper",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,16 +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.3",
|
|
40
|
+
"@thi.ng/arrays": "^2.9.7",
|
|
41
|
+
"@thi.ng/checks": "^3.6.5",
|
|
42
|
+
"@thi.ng/errors": "^2.5.8"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.
|
|
46
|
-
"esbuild": "^0.21.
|
|
45
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
46
|
+
"esbuild": "^0.21.5",
|
|
47
47
|
"typedoc": "^0.25.13",
|
|
48
|
-
"typescript": "^5.
|
|
48
|
+
"typescript": "^5.5.2"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"adjacency",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
],
|
|
95
95
|
"year": 2015
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
98
98
|
}
|
package/zipper.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare class Location<T> {
|
|
|
24
24
|
get prev(): Maybe<Location<T>>;
|
|
25
25
|
get next(): Maybe<Location<T>>;
|
|
26
26
|
replace(x: T): Location<T>;
|
|
27
|
-
update(fn: FnO<T, T>, ...
|
|
27
|
+
update(fn: FnO<T, T>, ...args: any[]): Location<T>;
|
|
28
28
|
insertLeft(x: T): Location<T>;
|
|
29
29
|
insertRight(x: T): Location<T>;
|
|
30
30
|
insertChild(x: T): Location<T>;
|
package/zipper.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { peek } from "@thi.ng/arrays/peek";
|
|
2
2
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
3
3
|
import { assert } from "@thi.ng/errors/assert";
|
|
4
|
-
const
|
|
4
|
+
const __newPath = (l, r, path, nodes, changed = false) => ({
|
|
5
5
|
l,
|
|
6
6
|
r,
|
|
7
7
|
path,
|
|
8
8
|
nodes,
|
|
9
9
|
changed
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const __changedPath = (path) => path ? { ...path, changed: true } : void 0;
|
|
12
12
|
class Location {
|
|
13
13
|
_node;
|
|
14
14
|
_ops;
|
|
@@ -57,7 +57,7 @@ class Location {
|
|
|
57
57
|
return lefts && lefts.length ? new Location(
|
|
58
58
|
peek(lefts),
|
|
59
59
|
this._ops,
|
|
60
|
-
|
|
60
|
+
__newPath(
|
|
61
61
|
lefts.slice(0, lefts.length - 1),
|
|
62
62
|
[this._node].concat(path.r || []),
|
|
63
63
|
path.path,
|
|
@@ -74,7 +74,7 @@ class Location {
|
|
|
74
74
|
return new Location(
|
|
75
75
|
rights[0],
|
|
76
76
|
this._ops,
|
|
77
|
-
|
|
77
|
+
__newPath(
|
|
78
78
|
(path.l || []).concat([this._node]),
|
|
79
79
|
r.length ? r : void 0,
|
|
80
80
|
path.path,
|
|
@@ -89,7 +89,7 @@ class Location {
|
|
|
89
89
|
return lefts && lefts.length ? new Location(
|
|
90
90
|
lefts[0],
|
|
91
91
|
this._ops,
|
|
92
|
-
|
|
92
|
+
__newPath(
|
|
93
93
|
void 0,
|
|
94
94
|
lefts.slice(1).concat([this._node], path.r || []),
|
|
95
95
|
path.path,
|
|
@@ -104,7 +104,7 @@ class Location {
|
|
|
104
104
|
return rights ? new Location(
|
|
105
105
|
peek(rights),
|
|
106
106
|
this._ops,
|
|
107
|
-
|
|
107
|
+
__newPath(
|
|
108
108
|
(path.l || []).concat(
|
|
109
109
|
[this._node],
|
|
110
110
|
rights.slice(0, rights.length - 1)
|
|
@@ -125,7 +125,7 @@ class Location {
|
|
|
125
125
|
return new Location(
|
|
126
126
|
children[0],
|
|
127
127
|
this._ops,
|
|
128
|
-
|
|
128
|
+
__newPath(
|
|
129
129
|
void 0,
|
|
130
130
|
r.length ? r : void 0,
|
|
131
131
|
path,
|
|
@@ -145,7 +145,7 @@ class Location {
|
|
|
145
145
|
(path.l || []).concat([this._node], path.r || [])
|
|
146
146
|
),
|
|
147
147
|
this._ops,
|
|
148
|
-
|
|
148
|
+
__changedPath(path.path)
|
|
149
149
|
);
|
|
150
150
|
} else {
|
|
151
151
|
return new Location(pnode, this._ops, path.path);
|
|
@@ -178,10 +178,10 @@ class Location {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
replace(x) {
|
|
181
|
-
return new Location(x, this._ops,
|
|
181
|
+
return new Location(x, this._ops, __changedPath(this._path));
|
|
182
182
|
}
|
|
183
|
-
update(fn, ...
|
|
184
|
-
return this.replace(fn(this._node, ...
|
|
183
|
+
update(fn, ...args) {
|
|
184
|
+
return this.replace(fn(this._node, ...args));
|
|
185
185
|
}
|
|
186
186
|
insertLeft(x) {
|
|
187
187
|
this.ensureNotRoot();
|
|
@@ -189,7 +189,7 @@ class Location {
|
|
|
189
189
|
return new Location(
|
|
190
190
|
this._node,
|
|
191
191
|
this._ops,
|
|
192
|
-
|
|
192
|
+
__newPath(
|
|
193
193
|
path.l ? path.l.concat([x]) : [x],
|
|
194
194
|
path.r,
|
|
195
195
|
path.path,
|
|
@@ -204,7 +204,7 @@ class Location {
|
|
|
204
204
|
return new Location(
|
|
205
205
|
this._node,
|
|
206
206
|
this._ops,
|
|
207
|
-
|
|
207
|
+
__newPath(
|
|
208
208
|
path.l,
|
|
209
209
|
[x].concat(path.r || []),
|
|
210
210
|
path.path,
|
|
@@ -231,7 +231,7 @@ class Location {
|
|
|
231
231
|
let loc = new Location(
|
|
232
232
|
peek(lefts),
|
|
233
233
|
this._ops,
|
|
234
|
-
|
|
234
|
+
__newPath(
|
|
235
235
|
lefts.slice(0, lefts.length - 1),
|
|
236
236
|
path.r,
|
|
237
237
|
path.path,
|
|
@@ -248,7 +248,7 @@ class Location {
|
|
|
248
248
|
return new Location(
|
|
249
249
|
this.newNode(peek(path.nodes), path.r || []),
|
|
250
250
|
this._ops,
|
|
251
|
-
|
|
251
|
+
__changedPath(path.path)
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
254
|
newNode(node, children) {
|