bare-script 2.2.7 → 2.2.8
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/lib/runtime.js +5 -1
- package/lib/runtimeAsync.js +10 -2
- package/package.json +1 -1
package/lib/runtime.js
CHANGED
|
@@ -138,7 +138,11 @@ export function executeScriptHelper(statements, options, locals) {
|
|
|
138
138
|
const ixArgLast = (statement.function.lastArgArray ?? null) && (funcArgsLength - 1);
|
|
139
139
|
for (let ixArg = 0; ixArg < funcArgsLength; ixArg++) {
|
|
140
140
|
const argName = statement.function.args[ixArg];
|
|
141
|
-
|
|
141
|
+
if (ixArg < argsLength) {
|
|
142
|
+
funcLocals[argName] = (ixArg === ixArgLast ? args.slice(ixArg) : args[ixArg]);
|
|
143
|
+
} else {
|
|
144
|
+
funcLocals[argName] = (ixArg === ixArgLast ? [] : null);
|
|
145
|
+
}
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
148
|
return executeScriptHelper(statement.function.statements, fnOptions, funcLocals);
|
package/lib/runtimeAsync.js
CHANGED
|
@@ -108,7 +108,11 @@ async function executeScriptHelperAsync(statements, options, locals) {
|
|
|
108
108
|
const ixArgLast = (statement.function.lastArgArray ?? null) && (funcArgsLength - 1);
|
|
109
109
|
for (let ixArg = 0; ixArg < funcArgsLength; ixArg++) {
|
|
110
110
|
const argName = statement.function.args[ixArg];
|
|
111
|
-
|
|
111
|
+
if (ixArg < argsLength) {
|
|
112
|
+
funcLocals[argName] = (ixArg === ixArgLast ? args.slice(ixArg) : args[ixArg]);
|
|
113
|
+
} else {
|
|
114
|
+
funcLocals[argName] = (ixArg === ixArgLast ? [] : null);
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
return executeScriptHelperAsync(statement.function.statements, fnOptions, funcLocals);
|
|
@@ -122,7 +126,11 @@ async function executeScriptHelperAsync(statements, options, locals) {
|
|
|
122
126
|
const ixArgLast = (statement.function.lastArgArray ?? null) && (funcArgsLength - 1);
|
|
123
127
|
for (let ixArg = 0; ixArg < funcArgsLength; ixArg++) {
|
|
124
128
|
const argName = statement.function.args[ixArg];
|
|
125
|
-
|
|
129
|
+
if (ixArg < argsLength) {
|
|
130
|
+
funcLocals[argName] = (ixArg === ixArgLast ? args.slice(ixArg) : args[ixArg]);
|
|
131
|
+
} else {
|
|
132
|
+
funcLocals[argName] = (ixArg === ixArgLast ? [] : null);
|
|
133
|
+
}
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
136
|
return executeScriptHelper(statement.function.statements, fnOptions, funcLocals);
|