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

@idvalidator/data-id-address

v1.0.2

Published

Optional Indonesia address reference data: province/regency/district hierarchy + postal-code reverse index, for use alongside idvalidator-id

Readme

@idvalidator/data-id-address

Optional Indonesia address reference data for use alongside idvalidator-id: full province/regency/district hierarchy (with names) and a postal-code -> district reverse index. Kept separate on purpose — see "Why a separate package" below.

npm install @idvalidator/data-id-address
import { nik, postalCode } from "idvalidator-id";
import { resolveAddress, lookupPostalCode } from "@idvalidator/data-id-address";

// Resolve a NIK's codes to real province/regency/district names
const parsed = nik.parse("3171051708900001");
resolveAddress(parsed);
// { province: { code: "31", name: "Daerah Khusus Ibukota Jakarta" },
//   regency:  { code: "71", name: "Kota Administrasi Jakarta Pusat" },
//   district: { code: "05", name: "Cempaka Putih" } }

// Resolve a postal code to its district, then to full names
const code = "40115";
if (postalCode.validate(code).valid) {
  const [match] = lookupPostalCode(code); // { provinceCode: "32", regencyCode: "73", districtCode: "09" }
  if (match) resolveAddress(match);
  // { province: { name: "Jawa Barat" }, regency: { name: "Kota Bandung" }, district: { name: "Bandung Wetan" } }
}

API

  • lookupProvince(provinceCode) -> { code, name } | null
  • lookupRegency(provinceCode, regencyCode) -> { provinceCode, code, name } | null
  • lookupDistrict(provinceCode, regencyCode, districtCode) -> { provinceCode, regencyCode, code, name } | null
  • resolveAddress({ provinceCode, regencyCode, districtCode? }) -> composes the three above
  • lookupPostalCode(code) -> { provinceCode, regencyCode, districtCode }[] — usually one match; ~7.5% of real postal codes resolve to more than one district, so all matches are returned
  • lookupPlateRegion(code) -> { code, areas }[string] | null — community-sourced, not official (see below)

Why a separate package

idvalidator-id's core nik and postalCode validators already embed a small province+regency dataset (enough to validate those two levels — see REFERENCE.md). Full district-level names (7,265 entries) and the postal reverse index push that past a reasonable default-bundle size (PRD §18 targets 15 KB gzip for the core package) — most consumers never need name resolution, just structural validation. Install this package only if you do.

Data

  • data/admin-hierarchy.json — provinces, regencies, and districts with codes + names. Provinces/regencies: Kepmendagri No. 300.2.2-2430 Tahun 2025, via github.com/cahyadsn/wilayah (MIT). Districts: same Kepmendagri reference, via github.com/lokabisa-oss/region-id (MIT) — a reproducible, FK-validated pipeline parsed directly from the official Kepmendagri PDF; used here because it's complete (7,285/7,285 districts) where an earlier hand-extracted source was missing 20.
  • data/postal-index.json — postal code -> district(s). Source: Kepmendagri No. 300.2.2-3128 Tahun 2025, via github.com/cahyadsn/wilayah_kodepos (MIT License), derived from an 83,762-row village-level dataset. Every district code in this index was cross-checked against admin-hierarchy.json with zero mismatches.
  • data/plate-region-codes.json — vehicle plate region code -> area name(s). Not from an official dataset — see the section below.

Not included as verified data: vehicle license plate region codes

Indonesian plate region codes (e.g. "B" -> Jakarta, "D" -> Bandung) are a Polri/Korlantas administrative assignment, not a Kemendagri code — and unlike the data above, there's no official machine-readable open dataset for it, only scattered, sometimes-inconsistent news articles. This package does include a lookupPlateRegion(code) table (community-supplied, cross-checked against public sources), but it's explicitly flagged as not officially verified — see its own doc comment and data/plate-region-codes.json's meta.source. Treat it as a helpful hint, not ground truth the way the province/regency/district/postal lookups above are.