diff --git a/index.js b/index.js index b122560e5cb01a04e6e8078e1ebcb158f6391ded..1541ca9746e3835a1e71f02cad9c9fba4d0901e6 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() }