npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bd-address

v1.0.3

Published

It returns division, district, upazila, unions of Bangladesh in Bengali and English

Downloads

14

Readme

BD Address

This package provides a set of functions to retrieve information about divisions, districts, upazillas, unions, and post codes in Bangladesh.

Installation

To use this project, you need to have Node.js installed. Then, you can install from npm or clone the repository.

npm install bd-address
git clone https://github.com/syedshaon/bd-address

Usage

You can import the BdAddress class and other functions from "bd-address" or index.js and use their methods to get the required data.

Example

import BdAddress, { bdUnions, bdUnionByUpazilla, bdPostCodes } from "bd-address";

// Get all divisions
const allDivisions = BdAddress.divisions();
console.log('All Divisions:', allDivisions);

// Get all districts
const allDistricts = BdAddress.districts();
console.log('All Districts:', allDistricts);

// Get districts by division id
const divisionId = '1'; // Example division id
const districtsByDivision = BdAddress.district(divisionId);
console.log(`Districts in Division ${divisionId}:`, districtsByDivision);

// Get all upazillas
const allUpazillas = BdAddress.upazillas();
console.log('All Upazillas:', allUpazillas);

// Get upazillas by district id
const districtId = '1'; // Example district id
const upazillasByDistrict = BdAddress.upazilla(districtId);
console.log(`Upazillas in District ${districtId}:`, upazillasByDistrict);

// Get all unions
const allUnions = bdUnions();
console.log('All Unions:', allUnions);

// Get unions by upazilla id
const upazillaId = '1'; // Example upazilla id
const unionsByUpazilla = bdUnionByUpazilla(upazillaId);
console.log(`Unions in Upazilla ${upazillaId}:`, unionsByUpazilla);

// Get all post codes
const allPostCodes = bdPostCodes();
console.log('All Post Codes:', allPostCodes);

Methods

BdAddress Class

  • BdAddress.divisions(): Returns all divisions.
  • BdAddress.districts(): Returns all districts.
  • BdAddress.district(id): Returns districts filtered by the given division id. If no id is provided, it returns a message asking for a division id.
  • BdAddress.upazillas(): Returns all upazillas.
  • BdAddress.upazilla(id): Returns upazillas filtered by the given district id. If no id is provided, it returns a message asking for a district id.

Functions

  • bdUnions(): Returns all unions.
  • bdUnionByUpazilla(id): Returns unions filtered by the given upazilla id. If no id is provided, it returns a message asking for an upazilla id.
  • bdPostCodes(): Returns all post codes.

Example Data Structure

Division

  {
    id: "1",
    name: "Chattagram",
    bn_name: "চট্টগ্রাম",
    url: "www.chittagongdiv.gov.bd"
  },
  ...
]

District

[
  {
    id: "1",
    division_id: "1",
    name: "Comilla",
    bn_name: "কুমিল্লা",
    lat: "23.4682747",
    lon: "91.1788135",
    url: "www.comilla.gov.bd"
  },
  ...
]

Upazilla

[
  {
    id: "1",
    district_id: "1",
    name: "Debidwar",
    bn_name: "দেবিদ্বার",
    url: "debidwar.comilla.gov.bd"
  },
  ...
]

Union

[
  {
    "id":"1",
    "upazilla_id":"1",
    "name":"Subil",
    "bn_name":"সুবিল",
    "url":"subilup.comilla.gov.bd"
  },
  ...
]

Post Codes

{
  "1206 ": {
    en: {
      division: "Dhaka",
      district: "Dhaka ",
      thana: "Dhaka ",
      suboffice: "Dhaka Cantonment--TSO ",
      postcode: "1206 ",
    },
    bn: {
      division: "ঢাকা",
      district: "ঢাকা ",
      thana: "ঢাকা সেনানিবাস ",
      suboffice: "ঢাকা সেনানিবাস TSO ",
      postcode: "১২০৬ ",
    },
  },
}

License This project is licensed under the MIT License.