diff --git a/index.js b/index.js index c62a4efc045137f2a3665a809795d2d6e3ec277c..2e4b1c1ec5c210c3c21088c693b899ff7fbab61d 100644 --- a/index.js +++ b/index.js @@ -247507,12 +247507,11 @@ async function getInseeCode(postalCode, city) { } else { if (!city) throw new Error('No city') - const parsedInput = sanitizeCity(city) + const parsedCity = sanitizeCity(city) - const filteredResponse = response.data.filter(city => { - const parsedCity = sanitizeCity(city.nomCommune) - return parsedCity === parsedInput || parsedCity.includes(parsedInput) - }) + const filteredResponse = response.data.filter(commune => + sanitizeCity(commune.nomCommune).includes(parsedCity) + ) return filteredResponse[0].codeCommune }