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

@jeardev/ph-address

v1.0.3

Published

Latest Philippine Address as of 2023

Readme

@jear-dev/ph-address

A TypeScript utility for extracting detailed Philippine address information — including barangay, city/municipality, province, region, and ZIP/postal code — from a full address using the Google Maps Geocoding API.


✨ Features

  • Parses and extracts:
    • ZIP / postal code
    • Barangay
    • City / Municipality
    • Province
    • Region
  • Designed specifically for Philippine address structures
  • Based on the official Google Maps Geocoding API
  • Fully typed with TypeScript
  • Lightweight and easy to integrate

📦 Installation

npm install @jear-dev/ph-address

🌐 Based on NAMRIA PH Data This library is guided by the official Philippine administrative boundaries provided by the National Mapping and Resource Information Authority (NAMRIA).

You can access the official dataset here: 🔗 https://data.humdata.org/dataset/cod-ab-phl

🧪 Usage

1️⃣ Regions

import { regions, regionByCode, regionsByName } from '@jear-dev/ph-address';

// Get all regions
const allRegions = await regions();

// Get region by code
const region = await regionByCode('PH01');

// Find regions by name
const namedRegions = await regionsByName('Region I (Ilocos Region)');

2️⃣ Provinces

import { provinces, provinceByCode, provinceByName } from '@jear-dev/ph-address';

// Get provinces by region code
const provinceList = await provinces('PH01');

// Get a province by code
const province = await provinceByCode('PH01028');

// Find province by name
const provinceByNameResult = await provinceByName('Ilocos Norte');

3️⃣ Cities / Municipalities

import { cities, cityByCode, cityByName } from '@jear-dev/ph-address';

// Get cities by province code
const cityList = await cities('PH01028');

// Get city by code
const city = await cityByCode('PH0102801');

// Find cities by name
const cityMatches = await cityByName('Adams');

4️⃣ Barangays

import { barangays, barangayByCode, barangayByName } from '@jear-dev/ph-address';

// Get barangays by city/municipality code
const brgyList = await barangays('PH0102801');

// Get barangay by code
const brgy = await barangayByCode('PH0102801001');

// Find barangays by name
const brgyMatches = await barangayByName('Adams (Pob.)');

5️⃣ ZIP Code from Address

import { getZipCodeFromAddress } from '@jear-dev/ph-address';

const zip = await getZipCodeFromAddress(
  'Adams, Ilocos Norte, Philippines',
  'YOUR_GOOGLE_MAPS_API_KEY'
);

console.log(zip); // Example: "2922"

🧾 Types

export interface Region {
  REGION_NAME: string;
  REGION_ALTNAME: string;
  REGION_PCODE: string;
  NATION_NAME: string;
  NATION_PCODE: string;
}

export interface Province {
  PROVINCE_NAME: string;
  PROVINCE_PCODE: string;
  PROVINCE_ALTNAME: string;
  REGION_NAME: string;
  REGION_PCODE: string;
}

export interface CityMun {
  CITY_MUN_NAME: string;
  CITY_MUN_PCODE: string;
  CITY_MUN_REF: string;
  CITY_MUN_ALTNAME: string;
  PROVINCE_NAME: string;
  PROVINCE_PCODE: string;
  REGION_NAME: string;
  REGION_PCODE: string;
}

export interface Barangay {
  BRGY_NAME: string;
  BRGY_PCODE: string;
  BRGY_REF: string;
  CITY_MUN_NAME: string;
  CITY_MUN_PCODE: string;
  PROVINCE_NAME: string;
  PROVINCE_PCODE: string;
  REGION_NAME: string;
  REGION_PCODE: string;
}

📄 License MIT License © 2025 @jear-dev