@weborigami/language 0.6.12 → 0.6.13
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 +2 -2
- package/src/compiler/parserHelpers.js +9 -8
- package/src/runtime/ops.js +2 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/language",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"description": "Web Origami expression language compiler and runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./main.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"typescript": "5.9.3"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@weborigami/async-tree": "0.6.
|
|
14
|
+
"@weborigami/async-tree": "0.6.13",
|
|
15
15
|
"exif-parser": "0.1.12",
|
|
16
16
|
"watcher": "2.3.1",
|
|
17
17
|
"yaml": "2.8.2"
|
|
@@ -316,21 +316,21 @@ export function makeLambda(params, body, location) {
|
|
|
316
316
|
*
|
|
317
317
|
* {
|
|
318
318
|
* x = { a: 1 }
|
|
319
|
-
* ...
|
|
320
|
-
*
|
|
319
|
+
* ...y
|
|
320
|
+
* z = { b: 2}
|
|
321
321
|
* }
|
|
322
322
|
*
|
|
323
323
|
* will be treated as:
|
|
324
324
|
*
|
|
325
325
|
* {
|
|
326
326
|
* x = { a: 1 }
|
|
327
|
-
*
|
|
328
|
-
* _result:
|
|
329
|
-
* x
|
|
330
|
-
* ...x
|
|
327
|
+
* z = { b: 2}
|
|
328
|
+
* _result: ops.merge(
|
|
329
|
+
* { x }
|
|
331
330
|
* y
|
|
332
|
-
*
|
|
333
|
-
*
|
|
331
|
+
* { z }
|
|
332
|
+
* )
|
|
333
|
+
* }._result
|
|
334
334
|
*
|
|
335
335
|
* @param {*} spreads
|
|
336
336
|
* @param {CodeLocation} location
|
|
@@ -338,6 +338,7 @@ export function makeLambda(params, body, location) {
|
|
|
338
338
|
function makeMerge(spreads, location) {
|
|
339
339
|
const topEntries = [];
|
|
340
340
|
const resultEntries = [];
|
|
341
|
+
|
|
341
342
|
for (const spread of spreads) {
|
|
342
343
|
if (spread[0] === ops.object) {
|
|
343
344
|
topEntries.push(...spread.slice(1));
|
package/src/runtime/ops.js
CHANGED
|
@@ -173,23 +173,12 @@ export function exponentiation(a, b) {
|
|
|
173
173
|
addOpLabel(exponentiation, "«ops.exponentiation»");
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
* Flatten the values of the given trees
|
|
176
|
+
* Flatten the values of the given trees to a depth of 1
|
|
177
177
|
*
|
|
178
178
|
* @param {...any} args
|
|
179
179
|
*/
|
|
180
180
|
export async function flat(...args) {
|
|
181
|
-
|
|
182
|
-
args.map(async (arg) => {
|
|
183
|
-
if (isUnpackable(arg)) {
|
|
184
|
-
arg = await arg.unpack();
|
|
185
|
-
}
|
|
186
|
-
return arg instanceof Array || typeof arg !== "object"
|
|
187
|
-
? arg
|
|
188
|
-
: await Tree.values(arg);
|
|
189
|
-
}),
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
return arrays.flat();
|
|
181
|
+
return Tree.flat(args, 2); // add 1 to account for the array of arguments
|
|
193
182
|
}
|
|
194
183
|
addOpLabel(flat, "«ops.flat»");
|
|
195
184
|
|