1.4.1 • Published 1 year ago

@aivangogh/ph-address v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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";
FunctionParamDescription
getAllRegions()Returns all regions available.
getAllProvinces()An array of TProvince objects sorted alphabetically by name.
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 TBarangay,
  type TMunicipality,
  type TProvince,
  type TRegion
} from "@aivangogh/ph-address"
type TBarangay = {
  name: string;
  psgcCode: string;
  municipalCityCode: string;
};

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

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

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

Reference

License

MIT

1.4.1

1 year ago

1.4.0

1 year ago

1.2.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago