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 🙏

© 2026 – Pkg Stats / Ryan Hefner

india-territory-lookup

v1.0.1

Published

A simple lookup for India territory information

Downloads

108

Readme

🇮🇳 india-state-lookup

A lightweight, zero-dependency TypeScript utility to look up Indian States and Union Territories using their LGD code, postal-style abbreviation, name, or administrative order.


👨‍💻 Author & Creator

Created with ❤️ by Abdou Belounis


💡 What is this?

india-state-lookup makes it easy to look up Indian States and Union Territories using different identifiers.

Whether you have an LGD code (32), an unpadded string ("2"), a mixed-case code ("kL"), a full name ("Kerala"), or an administrative order ("5th State"), findTerritory normalizes the input and returns the corresponding State or Union Territory object.

Each entry contains:

  • name — Full name of the State or Union Territory (e.g., "Kerala")
  • code — Two-letter abbreviation (e.g., "KL")
  • lgd — Local Government Directory code (e.g., "32")
  • category — Either "State" or "Union Territory"
  • order — Administrative order identifier (e.g., "5th State")

📦 Installation

Install the package via npm:

npm install india-state-lookup

Or using yarn / pnpm:

yarn add india-state-lookup
# or
pnpm add india-state-lookup

🚀 Quick Start & Usage

Import the default findTerritory function:

import findTerritory from 'india-state-lookup';

// Basic usage
findTerritory("KL");

// Returns:
// {
//   lgd: "32",
//   name: "Kerala",
//   code: "KL",
//   category: "State",
//   order: "5th State"
// }

⚡ Flexible Lookup

findTerritory supports multiple ways of identifying a State or Union Territory.

By LGD Code

findTerritory(32);
findTerritory("32");
findTerritory("032");

By Code

findTerritory("KL");
findTerritory("kl");
findTerritory("kL");

By Name

findTerritory("Kerala");
findTerritory("kerala");
findTerritory("KERALA");

By Administrative Order

findTerritory("5th State");
findTerritory("1st UT");
findTerritory("29th State");

All successful lookups return a StateOrUT object.


🏛️ States & Union Territories

The dataset contains 36 entries covering India's States and Union Territories.

Every entry includes a category property that distinguishes between the two:

import findTerritory from 'india-state-lookup';

console.log(findTerritory("dL"));

// {
//   lgd: "07",
//   name: "Delhi",
//   code: "DL",
//   category: "Union Territory",
//   order: "3rd UT"
// }

For a State:

console.log(findTerritory("KA"));

// {
//   lgd: "29",
//   name: "Karnataka",
//   code: "KA",
//   category: "State",
//   order: "4th State"
// }

📊 Accessing the Raw Data

If you need the complete dataset for dropdown menus, tables, filtering, or custom lookups, you can import indiaTerritories directly:

import { indiaTerritories } from 'india-state-lookup';

console.log(indiaTerritories.length); // 36

Each item follows the StateOrUT type:

type StateOrUT = {
  lgd: string | number;
  name: string;
  code: string;
  category: "State" | "Union Territory";
  order: string;
};

🔎 TypeScript Support

The package is written in TypeScript and includes a strongly typed StateOrUT interface.

const result = findTerritory("MH");

if (result) {
  console.log(result.name);     // "Maharashtra"
  console.log(result.code);     // "MH"
  console.log(result.lgd);      // "27"
  console.log(result.category); // "State"
  console.log(result.order);    // "16th State"
}

If no matching State or Union Territory is found, findTerritory returns null:

const result = findTerritory("Not a territory");

console.log(result); // null

📄 License

MIT © Abdou Belounis