ts-maps 0.3.3 → 0.3.4
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/core-map/style-spec/index.js +17 -0
- package/dist/index.js +17 -0
- package/package.json +1 -1
|
@@ -1428,6 +1428,23 @@ function registerLogicalOps() {
|
|
|
1428
1428
|
registerOperator("in", (args, compile, path) => {
|
|
1429
1429
|
if (args.length < 1)
|
|
1430
1430
|
throw new ExpressionError('"in" expects at least 1 argument', ["in", ...args], path);
|
|
1431
|
+
if (args.length === 2 && Array.isArray(args[1])) {
|
|
1432
|
+
const needle = compile(args[0], "value", path.concat(1));
|
|
1433
|
+
const haystack2 = compile(args[1], "value", path.concat(2));
|
|
1434
|
+
return {
|
|
1435
|
+
evaluate: (ctx) => {
|
|
1436
|
+
const x = needle.evaluate(ctx);
|
|
1437
|
+
const hay = haystack2.evaluate(ctx);
|
|
1438
|
+
if (Array.isArray(hay))
|
|
1439
|
+
return hay.some((value) => strictEq(x, value));
|
|
1440
|
+
if (typeof hay === "string")
|
|
1441
|
+
return typeof x === "string" && hay.includes(x);
|
|
1442
|
+
return false;
|
|
1443
|
+
},
|
|
1444
|
+
returnType: "boolean",
|
|
1445
|
+
...mergeDeps4([needle, haystack2])
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1431
1448
|
const input = compile(args[0], "value", path.concat(1));
|
|
1432
1449
|
const haystack = args.slice(1);
|
|
1433
1450
|
return {
|
package/dist/index.js
CHANGED
|
@@ -4725,6 +4725,23 @@ function registerLogicalOps() {
|
|
|
4725
4725
|
registerOperator("in", (args, compile, path) => {
|
|
4726
4726
|
if (args.length < 1)
|
|
4727
4727
|
throw new ExpressionError('"in" expects at least 1 argument', ["in", ...args], path);
|
|
4728
|
+
if (args.length === 2 && Array.isArray(args[1])) {
|
|
4729
|
+
const needle = compile(args[0], "value", path.concat(1));
|
|
4730
|
+
const haystack2 = compile(args[1], "value", path.concat(2));
|
|
4731
|
+
return {
|
|
4732
|
+
evaluate: (ctx) => {
|
|
4733
|
+
const x = needle.evaluate(ctx);
|
|
4734
|
+
const hay = haystack2.evaluate(ctx);
|
|
4735
|
+
if (Array.isArray(hay))
|
|
4736
|
+
return hay.some((value) => strictEq(x, value));
|
|
4737
|
+
if (typeof hay === "string")
|
|
4738
|
+
return typeof x === "string" && hay.includes(x);
|
|
4739
|
+
return false;
|
|
4740
|
+
},
|
|
4741
|
+
returnType: "boolean",
|
|
4742
|
+
...mergeDeps4([needle, haystack2])
|
|
4743
|
+
};
|
|
4744
|
+
}
|
|
4728
4745
|
const input = compile(args[0], "value", path.concat(1));
|
|
4729
4746
|
const haystack = args.slice(1);
|
|
4730
4747
|
return {
|