@weborigami/async-tree 0.2.5 → 0.2.6
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/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Jan Miksovsky and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/async-tree",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Asynchronous tree drivers based on standard JavaScript classes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./main.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"typescript": "5.7.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@weborigami/types": "0.2.
|
|
14
|
+
"@weborigami/types": "0.2.6"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "node --test --test-reporter=spec",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as trailingSlash from "../trailingSlash.js";
|
|
2
2
|
|
|
3
|
-
const treeToCaches = new
|
|
3
|
+
const treeToCaches = new Map();
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Given a key function, return a new key function and inverse key function that
|
|
@@ -111,12 +111,10 @@ function searchKeyMap(keyMap, key) {
|
|
|
111
111
|
let match;
|
|
112
112
|
if (keyMap.has(key)) {
|
|
113
113
|
match = keyMap.get(key);
|
|
114
|
-
} else
|
|
115
|
-
// Check
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
match = keyMap.get(withSlash);
|
|
119
|
-
}
|
|
114
|
+
} else {
|
|
115
|
+
// Check alternative with/without slash
|
|
116
|
+
const alternativeKey = trailingSlash.toggle(key, !trailingSlash.has(key));
|
|
117
|
+
match = keyMap.get(alternativeKey);
|
|
120
118
|
}
|
|
121
119
|
return match
|
|
122
120
|
? trailingSlash.toggle(match, trailingSlash.has(key))
|
package/src/operations/concat.js
CHANGED
|
@@ -20,14 +20,16 @@ export default async function concatTreeValues(treelike) {
|
|
|
20
20
|
for await (const value of deepValuesIterator(treelike, { expand: true })) {
|
|
21
21
|
let string;
|
|
22
22
|
if (value === null) {
|
|
23
|
-
console.warn("Warning: Origami template encountered a null value");
|
|
24
23
|
string = "null";
|
|
25
24
|
} else if (value === undefined) {
|
|
26
|
-
console.warn("Warning: Origami template encountered an undefined value");
|
|
27
25
|
string = "undefined";
|
|
28
26
|
} else {
|
|
29
27
|
string = toString(value);
|
|
30
28
|
}
|
|
29
|
+
if (value === null || value === undefined) {
|
|
30
|
+
const message = `Warning: Origami template encountered a ${string} value. To locate where this happened, build your project and search your build output for the text "${string}".`;
|
|
31
|
+
console.warn(message);
|
|
32
|
+
}
|
|
31
33
|
strings.push(string);
|
|
32
34
|
}
|
|
33
35
|
return strings.join("");
|
package/src/utilities.js
CHANGED
|
@@ -219,8 +219,12 @@ export const naturalOrder = new Intl.Collator(undefined, {
|
|
|
219
219
|
* @param {string[]} keys
|
|
220
220
|
*/
|
|
221
221
|
export function pathFromKeys(keys) {
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
// Ensure there's a slash between all keys. If the last key has a trailing
|
|
223
|
+
// slash, leave it there.
|
|
224
|
+
const normalized = keys.map((key, index) =>
|
|
225
|
+
index < keys.length - 1 ? trailingSlash.add(key) : key
|
|
226
|
+
);
|
|
227
|
+
return normalized.join("");
|
|
224
228
|
}
|
|
225
229
|
|
|
226
230
|
/**
|
package/test/utilities.test.js
CHANGED
|
@@ -59,6 +59,7 @@ describe("utilities", () => {
|
|
|
59
59
|
assert.equal(utilities.pathFromKeys([]), "");
|
|
60
60
|
assert.equal(utilities.pathFromKeys(["a", "b", "c"]), "a/b/c");
|
|
61
61
|
assert.equal(utilities.pathFromKeys(["a/", "b/", "c"]), "a/b/c");
|
|
62
|
+
assert.equal(utilities.pathFromKeys(["a/", "b/", "c/"]), "a/b/c/");
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
test("pipeline applies a series of functions to a value", async () => {
|