from-divisions-to-unions
v1.1.2
Published
this package is created for getting all divions , districts, upazilas, unions data
Readme
from-divisions-to-unions
A lightweight npm package to get all Divisions, Districts, Upazilas, and Unions of Bangladesh — with support for both Bangla and English data.
Installation
npm install from-divisions-to-unionsUsage
ES Module (React, Next.js, etc.)
import {
getAllDivision,
getAllDistrict,
getAllUpazila,
getAllUnion,
getDistricts,
getUpazilas,
getUnions,
} from 'from-divisions-to-unions';CommonJS (Express, Node.js, etc.)
const {
getAllDivision,
getAllDistrict,
getAllUpazila,
getAllUnion,
getDistricts,
getUpazilas,
getUnions,
} = require('from-divisions-to-unions');Functions
Get All Data
| Function | Description |
|---|---|
| getAllDivision() | Returns all divisions (Bangla by default) |
| getAllDistrict() | Returns all districts |
| getAllUpazila() | Returns all upazilas |
| getAllUnion() | Returns all unions |
Pass "en" as argument to get English data:
getAllDivision() // Bangla
getAllDivision("en") // English
getAllDistrict("en")
getAllUpazila("en")
getAllUnion("en")Get Filtered Data (by parent)
| Function | Description |
|---|---|
| getDistricts(division_value) | Get districts under a specific division |
| getUpazilas(district_value) | Get upazilas under a specific district |
| getUnions(upazila_value) | Get unions under a specific upazila |
const districts = getDistricts("dhaka"); // Bangla
const districts = getDistricts("dhaka", "en"); // English
const upazilas = getUpazilas("gazipur");
const unions = getUnions("kaliakair");Example Response
getAllDivision()
// [
// { value: "10", title: "ঢাকা" },
// { value: "40", title: "চট্টগ্রাম" },
// ...
// ]
getAllDivision("en")
// [
// { value: "10", title: "Dhaka" },
// { value: "40", title: "Chittagong" },
// ...
// ]Author
Seiam Al Mahmud
- GitHub: SeiamAlMahmud
- npm: from-divisions-to-unions
