pacc 4.39.1 → 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 +1 -1
- package/src/expression.mjs +8 -4
- package/types/expression.d.mts +2 -2
package/package.json
CHANGED
package/src/expression.mjs
CHANGED
|
@@ -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 (
|
|
307
|
-
|
|
306
|
+
if (b?.[Symbol.iterator]) {
|
|
307
|
+
for (const x of b) {
|
|
308
|
+
if (x === a) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
308
312
|
}
|
|
309
|
-
return
|
|
313
|
+
return false;
|
|
310
314
|
},
|
|
311
315
|
min: (a, b) => (a < b ? a : b),
|
|
312
316
|
max: (a, b) => (a > b ? a : b),
|
package/types/expression.d.mts
CHANGED
|
@@ -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) =>
|
|
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):
|
|
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;
|