From 2a34ec683ee630d5667abd1c6bd7767346c0afa8 Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Wed, 30 Jun 2021 15:36:04 +1000 Subject: fix within range test --- lib/withinRange.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/withinRange.js') diff --git a/lib/withinRange.js b/lib/withinRange.js index e75f788..3408a5a 100644 --- a/lib/withinRange.js +++ b/lib/withinRange.js @@ -28,7 +28,10 @@ module.exports = (feature, rangeFeature) => { const to = rangeParts[1].match(regexp).groups const i = feature.properties['addr:housenumber'].match(regexp).groups - if (i.num >= from.num && i.num <= to.num) { + if ( + Number.isInteger(Number(i.num)) && Number.isInteger(Number(from.num)) && Number.isInteger(Number(to.num)) && + Number(i.num) >= Number(from.num) && Number(i.num) <= Number(to.num) + ) { // feature within featureRange (ignore prefix/suffix) return true } else { -- cgit v1.2.3