From 3840b04b1270da3b4f0b344abf97b6081103b68f Mon Sep 17 00:00:00 2001 From: Christopher Blanchard Date: Thu, 14 Dec 2023 10:23:56 +0100 Subject: [PATCH] fix(Acronyms): Building name check Correctly handle acronyms in last segment of a building name --- src/utils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 8195af5..c57e9a6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -147,9 +147,11 @@ export const checkBuildingRange = ( ): BuildingRangeMatch | void => { const tokens = building_name.split(" "); const range = tokens.pop() || ""; - const tokenCopy = [...tokens]; - const rangeCheck = tokenCopy.pop() || ""; - if(isSingleCharacter(rangeCheck)) return + + // Check if final token is single character [A-Z] + const rangeCheck = [...tokens].pop() || ""; + if (isSingleCharacter(rangeCheck)) return; + if (range.match(BUILDING_RANGE_REGEX)) { return { range,