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

@pranamphd/digipin

v0.1.1

Published

TypeScript library for encoding and decoding India's DIGIPIN (Digital Postal Index Number).

Readme

digipin-ts

DIGIPIN (Digital Postal Index Number) is a national-level, geo-coded addressing grid developed by the Department of Posts, Ministry of Communications, Government of India. It provides a deterministic and reversible method to represent geographic locations in India using a 10-character alphanumeric code derived from latitude and longitude.

This repository contains a TypeScript implementation of the DIGIPIN algorithm, intended to enable consistent and correct adoption across platforms, applications, and systems.

DIGIPIN Logo

What this repository provides

  • Deterministic conversion from latitude / longitude → DIGIPIN
  • Reversible conversion from DIGIPIN → geographic coordinates
  • Comprehensive tests to ensure correctness
  • Implementation aligned with the final DIGIPIN Technical Specification (March 2025)

Specification reference

This project implements the DIGIPIN (Digital Postal Index Number) algorithm strictly according to the official technical specification published by the Department of Posts, Ministry of Communications, Government of India.

The authoritative specification is available at: https://www.indiapost.gov.in/digipin

All implementations in this repository aim to faithfully reproduce the behavior described in the final DIGIPIN Technical Document (March 2025).

This repository provides an independent implementation of the DIGIPIN specification and is not an official distribution of the Department of Posts unless explicitly stated otherwise.


Design principles

  • Specification-first: Implementation strictly follows the DIGIPIN technical specification.
  • Deterministic: The same input always produces the same output, regardless of language or platform.
  • No external dependencies: Core logic is self-contained.

Usage

npm i @pranamphd/digipin

TypeScript

import { encode, decode, Location } from "@pranamphd/digipin";

const location: Location = { latitude: 28.6139, longitude: 77.209 }; // Example coordinates for Kartavya Path, New Delhi

const digipin = encode(location); // Encode coordinates to DIGIPIN
console.log(digipin); // Example output: "39J438TJC7"

const decodedLocation = decode(digipin); // Decode DIGIPIN back to coordinates
console.log(decodedLocation); // Example output: { latitude: 28.6139, longitude: 77.209 }

JavaScript (CommonJS)

const {encode, decode} = require("@pranamphd/digipin");

let location = { latitude: 28.6139, longitude: 77.209 }; // Example coordinates for Kartavya Path, New Delhi

let digipin = encode(location); // Encode coordinates to DIGIPIN
console.log(digipin); // Example output: "39J438TJC7"

let decodedLocation = decode(digipin); // Decode DIGIPIN back to coordinates
console.log(decodedLocation); // Example output: { latitude: 28.6139, longitude: 77.209 }

JavaScript (ESM)

import { encode, decode } from "@pranamphd/digipin";

let location = { latitude: 28.6139, longitude: 77.209 }; // Example coordinates for Kartavya Path, New Delhi

let digipin = encode(location); // Encode coordinates to DIGIPIN
console.log(digipin); // Example output: "39J438TJC7"

let decodedLocation = decode(digipin); // Decode DIGIPIN back to coordinates
console.log(decodedLocation); // Example output: { latitude: 28.6139, longitude: 77.209 }

Status

This repository is under active development. The library interfaces (function and type signatures) may evolve until the first stable release (v1.0.0).


License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.