tova 0.10.1 → 0.10.3
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 +1 -1
- package/src/codegen/base-codegen.js +6 -2
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -875,7 +875,9 @@ export class BaseCodegen {
|
|
|
875
875
|
this.pushScope();
|
|
876
876
|
for (const v of vars) this.declareVar(v);
|
|
877
877
|
if (vars.length === 2) {
|
|
878
|
-
|
|
878
|
+
// for i, v in collection => auto-enumerate: use .entries() for index-value pairs
|
|
879
|
+
const entriesExpr = `(Array.isArray(${tempVar}) ? ${tempVar}.entries() : Object.entries(${tempVar}))`;
|
|
880
|
+
p.push(`${this.i()}${labelPrefix}for${awaitKeyword} (const [${vars[0]}, ${vars[1]}] of ${entriesExpr}) {\n`);
|
|
879
881
|
} else {
|
|
880
882
|
p.push(`${this.i()}${labelPrefix}for${awaitKeyword} (const ${vars[0]} of ${tempVar}) {\n`);
|
|
881
883
|
}
|
|
@@ -904,7 +906,9 @@ export class BaseCodegen {
|
|
|
904
906
|
for (const v of vars) this.declareVar(v);
|
|
905
907
|
const p = [];
|
|
906
908
|
if (vars.length === 2) {
|
|
907
|
-
|
|
909
|
+
// for i, v in collection => auto-enumerate: use .entries() for index-value pairs
|
|
910
|
+
const entriesExpr = `(Array.isArray(${iterExpr}) ? ${iterExpr}.entries() : Object.entries(${iterExpr}))`;
|
|
911
|
+
p.push(`${this.i()}${labelPrefix}for${awaitKeyword} (const [${vars[0]}, ${vars[1]}] of ${entriesExpr}) {\n`);
|
|
908
912
|
} else {
|
|
909
913
|
p.push(`${this.i()}${labelPrefix}for${awaitKeyword} (const ${vars[0]} of ${iterExpr}) {\n`);
|
|
910
914
|
}
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/embed-runtime.js — do not edit
|
|
2
|
-
export const VERSION = "0.10.
|
|
2
|
+
export const VERSION = "0.10.3";
|