From 98efb6c5ea2671f86307a004d33ffa296a93582f Mon Sep 17 00:00:00 2001 From: build-token <build-token> Date: Fri, 20 Jan 2023 13:15:55 +0000 Subject: [PATCH] publish: fix: handle communes with "St" generated from commit 2f73f3e7d4b38e5810f84d5e81922ec0117943cd --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index b122560..1541ca9 100644 --- a/index.js +++ b/index.js @@ -242125,6 +242125,7 @@ async function getInseeCode(postalCode, city) { const filteredResponse = response.data.filter( town => sanitizeCity(town.nomCommune) === parsedCity ) + return filteredResponse[0].codeCommune } } catch (error) { @@ -242143,6 +242144,7 @@ async function getInseeCode(postalCode, city) { function sanitizeCity(city) { return city .toLowerCase() + .replace(/st/g, 'saint') .replace(/[âêîôûäëïü-\sʼ'éèç]/g, match => REPLACE_CHARS[match]) .trim() } -- GitLab