@thi.ng/egf 0.6.198 → 0.6.200
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 +1 -1
- package/convert.js +4 -4
- package/package.json +12 -12
- package/parser.js +1 -1
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 211 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/convert.js
CHANGED
|
@@ -10,11 +10,11 @@ import { defPrefixer } from "./prefix.js";
|
|
|
10
10
|
const toEGF = (nodes, prefixes = {}, propFn) => {
|
|
11
11
|
const prefixID = defPrefixer(prefixes);
|
|
12
12
|
const res = [];
|
|
13
|
-
for (
|
|
13
|
+
for (const id in prefixes) {
|
|
14
14
|
res.push(`@prefix ${id}: ${prefixes[id]}`);
|
|
15
15
|
}
|
|
16
16
|
res.push("");
|
|
17
|
-
for (
|
|
17
|
+
for (const node of nodes) {
|
|
18
18
|
res.push(toEGFNode(node, prefixID, propFn), "");
|
|
19
19
|
}
|
|
20
20
|
return res.join("\n");
|
|
@@ -25,12 +25,12 @@ const toEGFNode = (node, prefix, propFn = toEGFProp) => {
|
|
|
25
25
|
const $prop = (p, pid, v) => res.push(
|
|
26
26
|
` ${pid} ` + (isNode(v) ? `-> ${prefix(v.$id) || v.$id}` : isRef(v) ? `-> ${prefix(v.$ref) || v.$ref}` : isToEGF(v) ? v.toEGF() : propFn(p, v))
|
|
27
27
|
);
|
|
28
|
-
for (
|
|
28
|
+
for (const p in node) {
|
|
29
29
|
if (p === "$id") continue;
|
|
30
30
|
const pid = prefix(p) || p;
|
|
31
31
|
const val = node[p];
|
|
32
32
|
if (isArray(val)) {
|
|
33
|
-
for (
|
|
33
|
+
for (const v of val) {
|
|
34
34
|
$prop(p, pid, v);
|
|
35
35
|
}
|
|
36
36
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/egf",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.200",
|
|
4
4
|
"description": "Extensible Graph Format",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@thi.ng/api": "^8.12.
|
|
44
|
-
"@thi.ng/checks": "^3.
|
|
45
|
-
"@thi.ng/dot": "^2.1.
|
|
46
|
-
"@thi.ng/errors": "^2.5.
|
|
47
|
-
"@thi.ng/logger": "^3.2.
|
|
48
|
-
"@thi.ng/prefixes": "^2.3.
|
|
49
|
-
"@thi.ng/strings": "^3.9.
|
|
50
|
-
"@thi.ng/transducers-binary": "^2.1.
|
|
51
|
-
"@thi.ng/trie": "^2.0.
|
|
43
|
+
"@thi.ng/api": "^8.12.10",
|
|
44
|
+
"@thi.ng/checks": "^3.8.0",
|
|
45
|
+
"@thi.ng/dot": "^2.1.123",
|
|
46
|
+
"@thi.ng/errors": "^2.5.50",
|
|
47
|
+
"@thi.ng/logger": "^3.2.9",
|
|
48
|
+
"@thi.ng/prefixes": "^2.3.61",
|
|
49
|
+
"@thi.ng/strings": "^3.9.31",
|
|
50
|
+
"@thi.ng/transducers-binary": "^2.1.190",
|
|
51
|
+
"@thi.ng/trie": "^2.0.9"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@thi.ng/equiv": "^2.1.
|
|
54
|
+
"@thi.ng/equiv": "^2.1.100",
|
|
55
55
|
"@types/node": "^24.10.1",
|
|
56
56
|
"esbuild": "^0.27.0",
|
|
57
57
|
"typedoc": "^0.28.14",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"status": "alpha",
|
|
112
112
|
"year": 2020
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "824bf9047b5a10f777c5c5b4aeecf0c750a22c75\n"
|
|
115
115
|
}
|
package/parser.js
CHANGED
|
@@ -161,7 +161,7 @@ const __parseRef = (id, ctx) => {
|
|
|
161
161
|
};
|
|
162
162
|
};
|
|
163
163
|
const __pruneNodes = ({ nodes, logger }) => {
|
|
164
|
-
for (
|
|
164
|
+
for (const id in nodes) {
|
|
165
165
|
const keys = Object.keys(nodes[id]);
|
|
166
166
|
if (keys.length === 1 && keys[0] === "$id") {
|
|
167
167
|
logger.debug("pruning node:", id);
|