@weborigami/language 0.0.53 → 0.0.54

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weborigami/language",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "description": "Web Origami expression language compiler and runtime",
5
5
  "type": "module",
6
6
  "main": "./main.js",
@@ -11,8 +11,8 @@
11
11
  "typescript": "5.4.5"
12
12
  },
13
13
  "dependencies": {
14
- "@weborigami/async-tree": "0.0.53",
15
- "@weborigami/types": "0.0.53",
14
+ "@weborigami/async-tree": "0.0.54",
15
+ "@weborigami/types": "0.0.54",
16
16
  "watcher": "2.3.1"
17
17
  },
18
18
  "scripts": {
@@ -30,7 +30,7 @@ export default async function mergeTrees(...trees) {
30
30
 
31
31
  // If all trees are plain objects, return a plain object.
32
32
  if (unpacked.every((tree) => isPlainObject(tree))) {
33
- return mergeObjects(...unpacked);
33
+ return Object.assign({}, ...unpacked);
34
34
  }
35
35
 
36
36
  // If all trees are arrays, return an array.
@@ -56,23 +56,3 @@ export default async function mergeTrees(...trees) {
56
56
 
57
57
  return result;
58
58
  }
59
-
60
- /**
61
- * Merge the indicated plain objects. If a key is present in multiple objects,
62
- * the value from the first object is used.
63
- *
64
- * This is similar to calling Object.assign() with the objects in reverse order,
65
- * but we want to ensure the keys end up in the same order they're encountered
66
- * in the objects.
67
- *
68
- * @param {...any} objects
69
- */
70
- function mergeObjects(...objects) {
71
- const result = {};
72
- for (const obj of objects) {
73
- for (const key of Object.keys(obj)) {
74
- result[key] ??= obj[key];
75
- }
76
- }
77
- return result;
78
- }
@@ -13,16 +13,15 @@ describe("mergeTrees", () => {
13
13
  b: 2,
14
14
  },
15
15
  {
16
- c: 3,
17
- d: 4,
16
+ b: 3,
17
+ c: 4,
18
18
  }
19
19
  );
20
20
  // @ts-ignore
21
21
  assert.deepEqual(await Tree.plain(tree), {
22
22
  a: 1,
23
- b: 2,
24
- c: 3,
25
- d: 4,
23
+ b: 3,
24
+ c: 4,
26
25
  });
27
26
  });
28
27
 
@@ -55,15 +54,14 @@ describe("mergeTrees", () => {
55
54
  b: 2,
56
55
  },
57
56
  {
58
- c: 3,
59
- d: 4,
57
+ b: 3,
58
+ c: 4,
60
59
  }
61
60
  );
62
61
  assert.deepEqual(result, {
63
62
  a: 1,
64
- b: 2,
65
- c: 3,
66
- d: 4,
63
+ b: 3,
64
+ c: 4,
67
65
  });
68
66
  });
69
67