Skip to content

Instantly share code, notes, and snippets.

@revolunet
Last active September 6, 2017 10:13
Show Gist options
  • Select an option

  • Save revolunet/3083779 to your computer and use it in GitHub Desktop.

Select an option

Save revolunet/3083779 to your computer and use it in GitHub Desktop.
liste regions et departements francais france
{
"regions": {
"alsace": [67, 68],
"aquitaine": [40, 47, 33, 24, 64],
"auvergne": [43, 3, 15, 63],
"basse-normandie": [14, 61, 50],
"bourgogne": [21, 58, 71, 89],
"bretagne": [29, 35, 22, 56],
"centre": [45, 37, 41, 28, 36, 18],
"champagne-ardenne": [10, 8, 52, 51],
"corse": ["2b", "2a"],
"franche-compte": [39, 25, 70, 90],
"haute-normandie": [27, 76],
"languedoc-roussillon": [48, 30, 34, 11, 66],
"limousin": [19, 23, 87],
"lorraine": [55, 54, 57, 88],
"midi-pyrennees": [46, 32, 31, 12, 9, 65, 81, 82],
"nord-pas-de-calais": [62, 59],
"pays-de-la-loire": [49, 44, 72, 53, 85],
"picardie": [2, 60, 80],
"poitou-charentes": [17, 16, 86, 79],
"provences-alpes-cote-dazur": [4, 5, 6, 13, 84, 83],
"rhones-alpes": [38, 42, 26, 7, 1, 74, 73, 69],
"ile-de-france": [77, 75, 78, 93, 92, 91, 95, 94]
}
};
@Rebolon
Copy link

Rebolon commented Sep 8, 2015

With underscoreJs here is a way to get an array of departments :
_.chain(ee).values().flatten().map(function(dept){return ("00" + dept).substr(-2,2);}).sort().value();

so here is a way to get a global object :

var list = {
    "regions": {
        "alsace": [67, 68],
        "aquitaine": [40, 47, 33, 24, 64],
        "auvergne": [43, 3, 15, 63],
        "basse-normandie": [14, 61, 50],
        "bourgogne": [21, 58, 71, 89],
        "bretagne": [29, 35, 22, 56],
        "centre": [45, 37, 41, 28, 36, 18],
        "champagne-ardenne": [10, 8, 52, 51],
        "corse": ["2b", "2a"],
        "franche-compte": [39, 25, 70, 90],
        "haute-normandie": [27, 76],
        "languedoc-roussillon": [48, 30, 34, 11, 66],
        "limousin": [19, 23, 87],
        "lorraine": [55, 54, 57, 88],
        "midi-pyrennees": [46, 32, 31, 12, 9, 65, 81, 82],
        "nord-pas-de-calais": [62, 59],
        "pays-de-la-loire": [49, 44, 72, 53, 85],
        "picardie": [2, 60, 80],
        "poitou-charentes": [17, 16, 86, 79],
        "provences-alpes-cote-dazur": [4, 5, 6, 13, 84, 83],
        "rhones-alpes": [38, 42, 26, 7, 1, 74, 73, 69],
        "ile-de-france": [77, 75, 78, 93, 92, 91, 95, 94]
        },
    "departements": {},
    "init": function() {
        return _.chain(list.regions).values().flatten().map(function(dept) {
              return ("00" + dept).substr(-2,2);
         }).sort().value();
     }
  };
  list.init();

@julestruong
Copy link

Would it be possible to update with the new regions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment