kommunkoder

1.1.1 • Public • Published

kommunkoder

NPM version Build Status Coverage Status Code Climate Dependency Status

Collection of all municipalities in Sweden with corresponding county and municipality codes (kommunkoder)

Data is provided by SCB (Statistiska Centralbyrån). Latest update to data used in lib was done 2015-03-09.

Install

$ npm install kommunkoder --save
$ bower install kommunkoder --save

Usage

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

Tests

# clone this repo 
$ npm install
$ npm test

License

MIT © Simon Johansson

Package Sidebar

Install

npm i kommunkoder

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • simon-johansson