@coffeebeanslabs/country_state_district

1.0.1 • Public • Published

country_state_district

By this package you can get a list of countries, states and districts. This package also allow to get districts and states in hindi and marathi also.

Note: This plugin will return a list of countries, states and districts by using our few methods. This will work with Node.js

Installation

npm i @coffeebeanslabs/country_state_district

Documentation

Get list of countries

It returns the details of the countries.

let country_state_district = require('@coffeebeanslabs/country_state_district');

let countries = country_state_district.getAllCountries();

Return value:

[
  { "id": 1, "name": "India" }
]

Get list of states

It returns the details of the states.

let country_state_district = require('@coffeebeanslabs/country_state_district');

let states = country_state_district.getAllStates();

Return value:

[
  { "id": 32, "name": "Tamil Nadu", "en_name": "Tamil Nadu", "hi_name": "तमिलनाडु", "mr_name": "तामिळनाडू", "country_id": 1 }
]

Get list of states using Country ID

It accepts a valid Country ID and returns State Details

let country_state_district = require('@coffeebeanslabs/country_state_district');

let states = country_state_district.getStatesByCountryId(1);

Return value:

[
  { "id": 32, "name": "Tamil Nadu", "en_name": "Tamil Nadu", "hi_name": "तमिलनाडु", "mr_name": "तामिळनाडू", "country_id": 1 }
]

Get list of districts

It returns the details of the states.

let country_state_district = require('@coffeebeanslabs/country_state_district');

let districts = country_state_district.getAllDistricts();

Return value:

[
    { "id": 32, "name": "Tamil Nadu", "en_name": "Tamil Nadu", "hi_name": "तमिलनाडु", "mr_name": "तामिळनाडू", "country_id": 1 }
]

Get list of districts using State ID

It accepts a valid State ID and returns District Details

let country_state_district = require('@coffeebeanslabs/country_state_district');

let districts = country_state_district.getDistrictsByStateId(32);

Return value:

[
  { "id": 578, "name": "Thoothukudi", "en_name": "Thoothukudi", "mr_name": "थुथुकुडी", "hi_name": "थुथुकुडी", "state_id": 32 }
]

Package Sidebar

Install

npm i @coffeebeanslabs/country_state_district

Weekly Downloads

10

Version

1.0.1

License

ISC

Unpacked Size

165 kB

Total Files

7

Last publish

Collaborators

  • imsheth
  • raj.dhivya
  • mitech11
  • preetisharma
  • greeshma_p
  • rishabhcb
  • ayub-cb