vega2ol 1.1.2 ā 1.1.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/dist/main.js +5 -1
- package/dist/tests/test-basic.js +5 -5
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -144,7 +144,11 @@ class VegaToOLVisitor {
|
|
|
144
144
|
if (arrayArg && valueArg) {
|
|
145
145
|
const arrayOL = this.visit(arrayArg);
|
|
146
146
|
const valueOL = this.visit(valueArg);
|
|
147
|
-
const inExpr = [
|
|
147
|
+
const inExpr = [
|
|
148
|
+
"in",
|
|
149
|
+
valueOL,
|
|
150
|
+
["literal", arrayOL],
|
|
151
|
+
];
|
|
148
152
|
// indexof(...) != -1 ā is in
|
|
149
153
|
if (operator === "!=") {
|
|
150
154
|
return inExpr;
|
package/dist/tests/test-basic.js
CHANGED
|
@@ -195,28 +195,28 @@ async function runTests() {
|
|
|
195
195
|
failed++;
|
|
196
196
|
// Test 13: Binary expressions
|
|
197
197
|
console.log("\nš Binary Expressions");
|
|
198
|
-
if (assertEqual(await vega2ol("indexof(['USA', 'India'], datum.country) != -1"), ["in", ["get", "country"], ["USA", "India"]], "indexOf with != -1 (is in)"))
|
|
198
|
+
if (assertEqual(await vega2ol("indexof(['USA', 'India'], datum.country) != -1"), ["in", ["get", "country"], ["literal", ["USA", "India"]]], "indexOf with != -1 (is in)"))
|
|
199
199
|
passed++;
|
|
200
200
|
else
|
|
201
201
|
failed++;
|
|
202
|
-
if (assertEqual(await vega2ol("-1 != indexof(['USA', 'India'], datum.country)"), ["in", ["get", "country"], ["USA", "India"]], "reverse indexOf with != -1 (is in)"))
|
|
202
|
+
if (assertEqual(await vega2ol("-1 != indexof(['USA', 'India'], datum.country)"), ["in", ["get", "country"], ["literal", ["USA", "India"]]], "reverse indexOf with != -1 (is in)"))
|
|
203
203
|
passed++;
|
|
204
204
|
else
|
|
205
205
|
failed++;
|
|
206
206
|
if (assertEqual(await vega2ol("indexof(['hot', 'warm'], datum.temperature) != -1 ? 'red' : 'blue'"), [
|
|
207
207
|
"case",
|
|
208
|
-
["in", ["get", "temperature"], ["hot", "warm"]],
|
|
208
|
+
["in", ["get", "temperature"], ["literal", ["hot", "warm"]]],
|
|
209
209
|
"red",
|
|
210
210
|
"blue",
|
|
211
211
|
], "indexOf in ternary (if in)"))
|
|
212
212
|
passed++;
|
|
213
213
|
else
|
|
214
214
|
failed++;
|
|
215
|
-
if (assertEqual(await vega2ol("indexof(['USA', 'India'], datum.country) == -1"), ["!", ["in", ["get", "country"], ["USA", "India"]]], "indexOf with == -1 (is not in)"))
|
|
215
|
+
if (assertEqual(await vega2ol("indexof(['USA', 'India'], datum.country) == -1"), ["!", ["in", ["get", "country"], ["literal", ["USA", "India"]]]], "indexOf with == -1 (is not in)"))
|
|
216
216
|
passed++;
|
|
217
217
|
else
|
|
218
218
|
failed++;
|
|
219
|
-
if (assertEqual(await vega2ol("-1 == indexof(['USA', 'India'], datum.country)"), ["!", ["in", ["get", "country"], ["USA", "India"]]], "reverse indexOf with == -1 (is not in)"))
|
|
219
|
+
if (assertEqual(await vega2ol("-1 == indexof(['USA', 'India'], datum.country)"), ["!", ["in", ["get", "country"], ["literal", ["USA", "India"]]]], "reverse indexOf with == -1 (is not in)"))
|
|
220
220
|
passed++;
|
|
221
221
|
else
|
|
222
222
|
failed++;
|