diff --git a/src/requests/insee.js b/src/requests/insee.js index a0a3dda04a6b40ca2f78c01c1822db7b82074bef..4ebf988248aa1bd19de788cfffcc9a6001591b84 100644 --- a/src/requests/insee.js +++ b/src/requests/insee.js @@ -22,6 +22,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 @@ -46,7 +47,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() } @@ -65,6 +66,7 @@ const REPLACE_CHARS = { ' ': '', ʼ: '', "'": '', + '’': '', é: 'e', è: 'e', ç: 'c',