Skip to content

Commit

Permalink
Merge pull request #33 from etalab/fix-29
Browse files Browse the repository at this point in the history
Fix issue #29
  • Loading branch information
ThomasG77 authored Feb 18, 2022
2 parents 9aa5b6a + 214a186 commit 923354f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions build/codes-postaux.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
const {groupBy, chain} = require('lodash')
const {groupBy, chain, uniq} = require('lodash')
const codesPostaux = require('./../sources/codes-postaux-with-fix.json')
const {MLP_CODES} = require('./mlp')

const codesPostauxIndex = groupBy(codesPostaux, 'codeCommune')

function getCodesPostaux(codeCommune) {
if (codeCommune in codesPostauxIndex) {
return codesPostauxIndex[codeCommune].map(i => i.codePostal)
}

// Cas spécifique de la commune de Suzan (non présente dans le fichier des codes postaux)
// Source Wikidata (https://www.wikidata.org/wiki/Q1363310)
if (codeCommune === '09304') {
return ['09240']
return uniq(codesPostauxIndex[codeCommune].map(i => i.codePostal))
}

return []
Expand Down

0 comments on commit 923354f

Please sign in to comment.