ugaddress
v1.0.1
Published
Get all regions and districts in Uganda
Downloads
4
Readme
OPEN UG ADDRESS
ugaddress
package helps you access Districts for specific regions in Uganda.
Installation
You can install ugaddress
via npm. I can run in any environment and has no dependency.
npm install ugaddress
Usage
ugaddress
provides a set of utility functions to fetch interact with the OPEN UG API
getDistricts
This function collects districts for a specific region. It accepts specifically 4 types of paramenters which are the four regions of Uganda:
"Northen"
"Eastern"
"Western"
"Central"
Note: This function is asynchronous and returns a promise so use
await
or chain it using the.then
function. The return type is an array of the districts.
import { getDistricts } from "ugaddress";
// When using async code
const districts = await getDistricts("Northen")
console.log(districts)
// When using synchronous code
getDistricts("Northern").then((districts) =>{
// Do something
})