pacc 4.39.1 → 4.39.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.39.1",
3
+ "version": "4.39.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "ava": "^6.4.1",
42
- "browser-ava": "^2.3.34",
42
+ "browser-ava": "^2.3.35",
43
43
  "c8": "^10.1.3",
44
44
  "documentation": "^14.0.3",
45
45
  "semantic-release": "^24.2.9",
46
- "typescript": "^5.9.2"
46
+ "typescript": "^5.9.3"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=22.20.0"
@@ -250,7 +250,7 @@ export function parse(input, context = { globals }) {
250
250
  left.path.push(args);
251
251
  left.eval = (node, current) => {
252
252
  const args = node.path[1].map(a =>
253
- typeof a === "object" ? a.eval(a,current) : a
253
+ typeof a === "object" ? a.eval(a, current) : a
254
254
  );
255
255
  return context.globals[node.path[0]](...args);
256
256
  };
@@ -303,10 +303,14 @@ export function parse(input, context = { globals }) {
303
303
 
304
304
  export const globals = {
305
305
  in: (a, b) => {
306
- if (Array.isArray(b)) {
307
- 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
+ }
308
312
  }
309
- return b.has(a);
313
+ return false;
310
314
  },
311
315
  min: (a, b) => (a < b ? a : b),
312
316
  max: (a, b) => (a > b ? a : b),
package/src/types.mjs CHANGED
@@ -35,6 +35,12 @@ function error(message) {
35
35
  }
36
36
 
37
37
  export function addType(type) {
38
+ if (type?.typeDefinition) {
39
+ const clazz = type;
40
+ type = type.typeDefinition;
41
+ type.clazz = clazz;
42
+ }
43
+
38
44
  if (types[type.name]) {
39
45
  return Object.assign(types[type.name], type);
40
46
  }
@@ -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;