@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/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
- const hoisted = [];
1263
- hoist(tree, hoisted);
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;