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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ind-state-district

v1.0.5

Published

![npmv](https://img.shields.io/npm/v/ind-state-district)![types](https://img.shields.io/npm/types/ind-state-district)![downloads](https://img.shields.io/npm/dt/ind-state-district )

Readme

ind-states-districts

npmvtypesdownloads

⚠ There was a problem with retrieving data from the functions, which has been resolved in the current version. Sorry! If this has caused any problems when using these packages.

This npm package provides a list of districts across all states and union territories of India, along with their respective state codes(short forms) and district codes(short forms).

Installation

  npm install ind-state-district

Usage

1. State.getAllStates()

This function returns an array of objects, where each object represents a state/union territory in India and contains the following properties:

  • stateName: The name of the state/union territory.
  • tin: The taxpayer identification number of the state/union territory.
  • stateCode: The short form of the state/union territory name
  • isUT: If the current state is an Union Territory or not.
[
  { stateName: 'Andhra Pradesh', tin: '37', stateCode: 'AP',isUT:false },
  { stateName: 'Arunachal Pradesh', tin: '12', stateCode: 'AR',isUT:true },....
}

2. State.getStateNameFromCode(stateCode)

This function returns a string, the full name of state/union territory.

const {State} = require("state-district-ind")

console.log(State.getStateNameFromCode("OD"));

//Output - Odisha

3. Districts.getAllDistricts()

This function returns an array of objects, where each object represents a district of the all states/union territories in India and contains the following properties:

  • districtName: The name of the district.
  • stateCode: The short form of the state/union territory name
  • districtCode: The short form of the district name
[
  { districtName: 'Nicobar', stateCode: 'AN', districtCode: 'NI' },
  {
    districtName: 'North and Middle Andaman',
    stateCode: 'AN',
    districtCode: 'NMA'
  },
  {
    districtName: 'South Andaman',
    stateCode: 'AN',
    districtCode: 'SA'
  },....
]

4. Districts.getAllDistrictsByStateCode(stateCode)|Districts.getDistrictNameFromStateName(stateName)

This function returns an array of objects, where each object represents a district of the particular states/union territory of India and contains the following properties:

  • districtName: The name of the district.
  • stateCode: The short form of the state/union territory name
  • districtCode: The short form of the district name
    //Districts.getDistrictNameFromStateName("Andhra Pradesh")
[
    {
      "districtName": "Alluri Sitarama Raju",
      "stateCode": "AP",
      "districtCode": "ASR"
    },
    {
      "districtName": "Anakapalle",
      "stateCode": "AP",
      "districtCode": "AKP"
    },
    {
      "districtName": "Ananthapuramu",
      "stateCode": "AP",
      "districtCode": "ATP"
    },.....
]

5. Districts.getDistrictNameFromCode(districtCode)

This function returns a string, the full name of district.

const {Districts} = require("state-district-ind")

console.log(Districts.getDistrictNameFromCode("GTR"));
// Output - Gunter

Version

  • 1.0.2
    • Minor fixes
  • 1.0.1
    • Addition of state and district functionality

Acknowledgements

  • Vikaspedia - For data collection
  • TSUP - Simplest libraries to bundle Typescript