@weborigami/language 0.4.1 → 0.4.2

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.4.1",
3
+ "version": "0.4.2",
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.8.2"
12
12
  },
13
13
  "dependencies": {
14
- "@weborigami/async-tree": "0.4.1",
15
- "@weborigami/types": "0.4.1",
14
+ "@weborigami/async-tree": "0.4.2",
15
+ "@weborigami/types": "0.4.2",
16
16
  "watcher": "2.3.1",
17
17
  "yaml": "2.7.0"
18
18
  },
@@ -156,14 +156,29 @@ export function entryKey(entry, object = null, eagerProperties = []) {
156
156
  return trailingSlash.add(key);
157
157
  }
158
158
 
159
+ if (!(value instanceof Array)) {
160
+ // Can't be a subtree
161
+ return trailingSlash.remove(key);
162
+ }
163
+
164
+ // If we're dealing with a getter, work with what that gets
165
+ if (value[0] === ops.getter) {
166
+ value = value[1];
167
+ }
168
+
159
169
  // If entry will definitely create a subtree, add a trailing slash
160
- const entryCreatesSubtree =
161
- value instanceof Array &&
162
- (value[0] === ops.object ||
163
- (value[0] === ops.getter &&
164
- value[1] instanceof Array &&
165
- (value[1][0] === ops.object || value[1][0] === ops.merge)));
166
- return trailingSlash.toggle(key, entryCreatesSubtree);
170
+ if (value[0] === ops.object) {
171
+ // Subtree
172
+ return trailingSlash.add(key);
173
+ }
174
+
175
+ // See if it looks a merged object
176
+ if (value[1] === "_result" && value[0][0] === ops.object) {
177
+ // Merge
178
+ return trailingSlash.add(key);
179
+ }
180
+
181
+ return key;
167
182
  }
168
183
 
169
184
  function keys(object, eagerProperties, propertyIsEnumerable, entries) {