** Effortlessly retrieve the names of Kenya's counties, constituencies, and wards **
- Get names,codes and constituencies of all counties in kenya
- Get names and wards of all constituences in kenya
- Get names of all wards in kenya
npm install kenya-administrative-divisions
OR
yarn add kenya-administrative-divisions
Once the package is installed you use the require approach
const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
OR
import kenyaAdministrativeDivisions from 'kenya-administrative-divisions'
Or with TypeScript
import * as kenyaAdministrativeDivisions from 'kenya-administrative-divisions'
create a .d.ts
file and add
declare module 'kenya-administrative-divisions'
This will retrieve all counties,their names,their code and their constituences. The constituences will also include the ward names. Do not pass parameters to this function.
const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
kenyaAdministrativeDivisions.getAll();
This will retrieve information about counties.
const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
// To get all counties and their county code
kenyaAdministrativeDivisions.getCounties();
// To get the county the constituencies of a particular county pass the county name
kenyaAdministrativeDivisions.getCounties("nairobi");
kenyaAdministrativeDivisions.getCounties("kis");
// To get the county the constituencies of a particular county pass the county code
kenyaAdministrativeDivisions.getCounties(47);
This will retrieve information about a particular county.
const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
// To get the county the constituencies of a particular county pass the county name
kenyaAdministrativeDivisions.getCounties("nairobi");
kenyaAdministrativeDivisions.getCounties("momb");
// To get the county the constituencies of a particular county pass the county code
kenyaAdministrativeDivisions.getCounties(47);
This will retrieve information about constituencies
const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
// To get all constituencies and their wards
kenyaAdministrativeDivisions.getConstituencies();
// To get information about a particular constituency pass a string to the function
kenyaAdministrativeDivisions.getConstituencies("mwea");
// To get all constituencies of a particular county pass the county code as a parameter
kenyaAdministrativeDivisions.getConstituencies(1);
This will retrieve all information about wards
const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
// To get all the wards
kenyaAdministrativeDivisions.getWards();
// To get a particular ward pass the name of the wards as a parameter
kenyaAdministrativeDivisions.getWards("bangale");
// To get wards in a county, by code
kenyaAdministrativeDivisions.getWards(43);