JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 569
  • Score
    100M100P100Q107537F
  • License MIT

A collection of philippine geographic data based on PSGC

Package Exports

  • @aivangogh/ph-address
  • @aivangogh/ph-address/dist/index.js
  • @aivangogh/ph-address/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aivangogh/ph-address) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PH-Address

A collection of philippine geographic data based on PSGC

Installing

Package manager

Using npm:

$ npm install @aivangogh/ph-address

Using yarn:

$ yarn add @aivangogh/ph-address

Using pnpm:

$ pnpm add @aivangogh/ph-address

Using bun:

$ bun add @aivangogh/ph-address

Once the package is installed, you can import the library using import or require approach:

import {
  getAllRegions,
  getAllProvinces,
  getMunicipalitiesByProvince,
  getBarangaysByMunicipality,
  getBarangaysByMunicipalityAndProvince,
} from "@aivangogh/ph-address";
Function Param Description
getAllRegions() Returns all regions available.
getAllProvinces() Returns all provinces available.
getProvincesByRegion() code {string} The code of the region to filter province by.
getMunicipalitiesByProvince() code {string} The code of the province to filter municipalities by.
getBarangaysByMunicipality() code {string} The code of the municipality to filter barangays by.

Example

import {
  getMunicipalitiesByProvince,
  getBarangaysByMunicipality,
} from "@aivangogh/ph-address";

// All municipaliy/city in Bohol
console.log(getMunicipalitiesByProvince("071200000"));

// All barangays in the city of Cebu City
console.log(getBarangaysByMunicipality("072217000"));

Types

You can use this types as well.

import {
  type PHBarangay,
  type PHMunicipality,
  type PHProvince,
  type PHRegion
} from "@aivangogh/ph-address"
type PHBarangay = {
  name: string;
  psgcCode: string;
  municipalCityCode: string;
};

type PHMunicipality = {
  name: string;
  psgcCode: string;
  provinceCode: string;
};

type PHProvince = {
  name: string;
  psgcCode: string;
  regionCode: string;
};

type PHRegion = {
  name: string;
  psgcCode: string;
  designation: string;
};

Reference

License

MIT