From 98e73b94276e1c5d0f87987ec7150bf5ce7e4f41 Mon Sep 17 00:00:00 2001 From: Ryan Hamley Date: Fri, 14 Feb 2020 07:41:54 -0800 Subject: [PATCH] Allow needle argument to 'in' expression to be false (#9295) --- src/style-spec/expression/definitions/in.js | 2 +- test/integration/expression-tests/in/basic-string/test.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/style-spec/expression/definitions/in.js b/src/style-spec/expression/definitions/in.js index 4ab63beb81f..f2fbac0224d 100644 --- a/src/style-spec/expression/definitions/in.js +++ b/src/style-spec/expression/definitions/in.js @@ -62,7 +62,7 @@ class In implements Expression { const needle = (this.needle.evaluate(ctx): any); const haystack = (this.haystack.evaluate(ctx): any); - if (!needle || !haystack) return false; + if (needle == null || !haystack) return false; if (!isComparableRuntimeValue(needle)) { throw new RuntimeError(`Expected first argument to be of type boolean, string or number, but found ${toString(typeOf(needle))} instead.`); diff --git a/test/integration/expression-tests/in/basic-string/test.json b/test/integration/expression-tests/in/basic-string/test.json index f985e9ca98b..728f1d0846a 100644 --- a/test/integration/expression-tests/in/basic-string/test.json +++ b/test/integration/expression-tests/in/basic-string/test.json @@ -24,7 +24,7 @@ false, true, true, - false, + true, true, false ],