@nyariv/sandboxjs 0.8.24 → 0.8.26
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/README.md +1 -1
- package/build/eval.d.ts +3 -0
- package/build/eval.js +14 -1
- package/build/parser.js +4 -5
- package/build/utils.d.ts +3 -0
- package/build/utils.js +8 -0
- package/dist/Sandbox.js +14 -1
- package/dist/Sandbox.js.map +1 -1
- package/dist/Sandbox.min.js +1 -1
- package/dist/Sandbox.min.js.map +1 -1
- package/dist/SandboxExec.js.map +1 -1
- package/dist/SandboxExec.min.js +1 -1
- package/dist/SandboxExec.min.js.map +1 -1
- package/dist/eval.d.ts +3 -0
- package/dist/executor.js +1 -1
- package/dist/executor.js.map +1 -1
- package/dist/node/Sandbox.js +13 -0
- package/dist/node/eval.d.ts +3 -0
- package/dist/node/parser.js +4 -5
- package/dist/node/utils.d.ts +3 -0
- package/dist/node/utils.js +11 -0
- package/dist/parser.js +4 -5
- package/dist/parser.js.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +9 -1
- package/dist/utils.js.map +1 -1
- package/jest.config.js +200 -0
- package/package.json +18 -17
- package/tsconfig.jest.json +16 -0
package/dist/parser.js
CHANGED
|
@@ -1259,11 +1259,10 @@ function lispifyFunction(str, constants, expression = false) {
|
|
|
1259
1259
|
if (!str.trim().length)
|
|
1260
1260
|
return [];
|
|
1261
1261
|
const tree = lispifyBlock(str, constants, expression);
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
return hoisted.concat(tree);
|
|
1262
|
+
hoist(tree);
|
|
1263
|
+
return tree;
|
|
1265
1264
|
}
|
|
1266
|
-
function hoist(item, res) {
|
|
1265
|
+
function hoist(item, res = []) {
|
|
1267
1266
|
if (isLisp(item)) {
|
|
1268
1267
|
if (!isLisp(item))
|
|
1269
1268
|
return false;
|
|
@@ -1292,7 +1291,7 @@ function hoist(item, res) {
|
|
|
1292
1291
|
}
|
|
1293
1292
|
if (rep.length !== item.length) {
|
|
1294
1293
|
item.length = 0;
|
|
1295
|
-
item.push(...rep);
|
|
1294
|
+
item.push(...res, ...rep);
|
|
1296
1295
|
}
|
|
1297
1296
|
}
|
|
1298
1297
|
return false;
|