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

@devzoy/indian-pincode

v2.1.0

Published

Offline-first Indian pincode validation and state/district lookup. Small core, no runtime network calls, works in Node, browsers, bundlers, and edge runtimes.

Readme

@devzoy/indian-pincode (core)

Offline-first Indian pincode validation and pincode → state/district lookup for Node.js, browsers, and edge runtimes.

npm License: MIT

No runtime network calls, no Node built-ins in the bundle — this package works identically in Node, browsers, bundlers (Vite/webpack/esbuild), edge runtimes (Workers, Deno Deploy), and React Native. For post offices, coordinates, and geospatial search, install the companion @devzoy/indian-pincode-geo package — it re-exports everything here plus geo functions, so you only need one import.

Install

npm install @devzoy/indian-pincode

Usage

CommonJS shown; ESM works identically (import pincode from '@devzoy/indian-pincode').

const pincode = require('@devzoy/indian-pincode');

pincode.validate('110001');                     // true  — exists in the dataset
pincode.isWellFormed('999999');                  // true  — well-formed 6-digit code, format only
pincode.getState('560001');                      // "KARNATAKA"
pincode.getDetails('682555').state;              // "LAKSHADWEEP"
pincode.getDistricts('110025');                  // ["BUDAUN", "SOUTH", "SOUTH EAST"] — cross-state pincode
pincode.listStates().length;                     // 36
pincode.listDistricts('KERALA').slice(0, 3);     // ["ALAPPUZHA", "ERNAKULAM", "IDUKKI"]
pincode.getPincodes({ state: 'GOA' }).length;     // pincodes in Goa

API reference

| Function | Returns | | :--- | :--- | | validate(pin) | boolean — pincode exists in the dataset | | isWellFormed(pin) | boolean — format check only (6 digits); doesn't imply it exists | | getState(pin) | primary state name, or null | | getDistricts(pin) | array of every district the pincode touches | | getDetails(pin) | { pincode, state, states, stateSource, districts } | | listStates() | every state/UT name in the dataset | | listDistricts(state) | districts that occur in that state (scoped, not global) | | getPincodes({ state, district }) | pincodes matching the given filter(s) | | preload() | force an eager data load instead of loading on first call | | DATA_VERSION | dataset snapshot version string, e.g. "2025.10.03" |

getDetails(pin) returns state — the primary state for that pincode (the one with the most post offices; ties broken alphabetically) — and states, an array of every state the pincode actually touches. These differ only for the ~52 pincodes that straddle a state boundary; for everything else states has exactly one entry. stateSource tells you whether the state was read directly from source data or inferred during cleaning.

Keys throughout are camelCase, matching Node/JS convention (the Python package uses snake_case instead — see its own README).

Requirements

Node >=20. Works in any environment that supports modern ESM/CJS interop and has no Node built-ins requirement (browsers, Deno, Workers, React Native).

Data freshness

DATA_VERSION is the India Post snapshot date this build was compiled from (currently 2025.10.03). The upstream dataset hasn't changed content since at least October 2025; releases of this package are content-gated, not calendar-gated — you get a new snapshot when India Post actually revises the data, not on a fixed monthly schedule.

Data quality

India Post's own state/district labeling has some gaps and inconsistencies at the source. This package's build pipeline normalizes state/district names to a single consistent spelling and backfills a small number of rows with missing state data from unambiguous evidence, tagging every backfilled row via stateSource. Full methodology and stats: data/REPORT.md.

License

  • Code: MIT.
  • Data: derived from India Post / data.gov.in under the Government Open Data License – India (GODL-India), which requires attribution — see DATA_LICENSE.md.

Links