Skip to content

Commit

Permalink
Support booleans in LocalFilterer
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Oct 16, 2023
1 parent c52bdfc commit 11e0653
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/essence/Ancillary/LocalFilterer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const LocalFilterer = {
if (!isNaN(value) && !isNaN(parseFloat(value))) type = 'number'
else if (typeof value === 'string') type = 'string'
else if (typeof value === 'number') type = 'number'
else if (typeof value === 'boolean') type = 'boolean'

if (type != null) {
// First type will be from index 0
Expand Down Expand Up @@ -124,13 +125,18 @@ const LocalFilterer = {
for (let i = 0; i < filter.values.length; i++) {
const v = filter.values[i]
if (v && v.key != null) {
const featureValue =
let featureValue =
v.key === 'geometry.type'
? feature.geometry.type
: F_.getIn(feature.properties, v.key)
let filterValue = v.value
if (v.type === 'number' && v.op != ',')
filterValue = parseFloat(filterValue)
else if (v.type === 'boolean') {
if (featureValue == null) featureValue = false
filterValue = filterValue == 'true'
}

if (featureValue != null) {
switch (v.op) {
case '=':
Expand Down

0 comments on commit 11e0653

Please sign in to comment.