pacc 4.39.0 → 4.39.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.39.0",
3
+ "version": "4.39.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -248,12 +248,15 @@ export function parse(input, context = { globals }) {
248
248
  }
249
249
  }
250
250
  left.path.push(args);
251
- left.eval = node => {
251
+ left.eval = (node, current) => {
252
252
  const args = node.path[1].map(a =>
253
- typeof a === "object" ? a.eval(a) : a
253
+ typeof a === "object" ? a.eval(a, current) : a
254
254
  );
255
255
  return context.globals[node.path[0]](...args);
256
256
  };
257
+
258
+ advance();
259
+
257
260
  return left;
258
261
  }
259
262
  break;
@@ -300,10 +303,14 @@ export function parse(input, context = { globals }) {
300
303
 
301
304
  export const globals = {
302
305
  in: (a, b) => {
303
- if (Array.isArray(b)) {
304
- return b.find(x => x === a) ? true : false;
306
+ if (b?.[Symbol.iterator]) {
307
+ for (const x of b) {
308
+ if (x === a) {
309
+ return true;
310
+ }
311
+ }
305
312
  }
306
- return b.has(a);
313
+ return false;
307
314
  },
308
315
  min: (a, b) => (a < b ? a : b),
309
316
  max: (a, b) => (a > b ? a : b),
@@ -1,7 +1,7 @@
1
1
  export function binop(op: any, left: any, right: any, fallback: any): any;
2
2
  export function parse(input: any, context?: {
3
3
  globals: {
4
- in: (a: any, b: any) => any;
4
+ in: (a: any, b: any) => boolean;
5
5
  min: (a: any, b: any) => any;
6
6
  max: (a: any, b: any) => any;
7
7
  substring: (s: any, a: any, b: any) => any;
@@ -9,7 +9,7 @@ export function parse(input: any, context?: {
9
9
  };
10
10
  }): any;
11
11
  export namespace globals {
12
- export function _in(a: any, b: any): any;
12
+ export function _in(a: any, b: any): boolean;
13
13
  export { _in as in };
14
14
  export function min(a: any, b: any): any;
15
15
  export function max(a: any, b: any): any;