From cd694bc43d223efc7d61ebb96f102e26c9379c7c Mon Sep 17 00:00:00 2001 From: build-token <build-token> Date: Fri, 3 Feb 2023 08:42:07 +0000 Subject: [PATCH] publish: fix(insee api): handle apostrophe generated from commit f4de04b00535400030033a0389aace464c3c21d6 --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 0a34b79..f66c9dd 100644 --- a/index.js +++ b/index.js @@ -247508,6 +247508,7 @@ async function getInseeCode(postalCode, city) { if (!city) throw new Error('No city') const parsedCity = sanitizeCity(city) + console.log(parsedCity) const filteredResponse = response.data.filter( town => sanitizeCity(town.nomCommune) === parsedCity @@ -247532,7 +247533,7 @@ function sanitizeCity(city) { return city .toLowerCase() .replace(/\bst\b/i, 'saint') - .replace(/[âêîôûäëïü-\sʼ'éèç]/g, match => REPLACE_CHARS[match]) + .replace(/[âêîôûäëïü-\sʼ'’éèç]/g, match => REPLACE_CHARS[match]) .trim() } @@ -247551,6 +247552,7 @@ const REPLACE_CHARS = { ' ': '', ʼ: '', "'": '', + '’': '', é: 'e', è: 'e', ç: 'c', -- GitLab