Collection of all municipalities in Sweden with corresponding county and municipality codes (kommunkoder)
Data is provided by SCB (Statistiska Centralbyrån). Lib is up-to-date as of 2015-07-03, no changes to either counties or municipalities will be made until 2016-01-01.
####Client
$ bower install kommunkoder --save
####Node
$ npm install kommunkoder --save
##Include
####Client
<script src="bower_components/kommunkoder/kommunkoder.min.js"></script>
####Node
var kommunkoder = require('kommunkoder');
kommunkoder();
// → [ Array of all municipalities ]
kommunkoder(1440);
// → { code: '1440', municipality: 'Ale', county: 'Västra Götalands län' }
kommunkoder({municipality: "Falkenberg"});
// → { code: "1382", municipality: "Falkenberg", county: "Hallands län" }
kommunkoder({county: "Stockholms län"});
// → [ Array of all municipalities in specified county ]
// pass an array of searches to get an array of multiple results
kommunkoder(["1231", "1233", {municipality: "Skövde"}]);
// → [{ code: '1231', municipality: 'Burlöv', county: 'Skåne län' },
// { code: '1233', municipality: 'Vellinge', county: 'Skåne län' },
// { code: '1496', municipality: 'Skövde', county: 'Västra Götalands län' }]
// 'undefined' is retunred if no match is found
kommunkoder(666);
// → undefined
# clone this repo
$ npm install
$ npm test
MIT © Simon Johansson