1.0.3 • Published 2 years ago

@efdiaz/psgc v1.0.3

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Philippine Standard Geographic Code (PSGC)

Provides PSGC (Philippine Standard Geographic Code) data for your applications and API's.

Installation

npm install --save @efdiaz/psgc

Usage

MethodParamTypeDescriptionExample
getRegionsGet all the regions
getProvincesregCodestringGet all province by region code"04"
getCityMunsprovCodestringGet all cities/municipalities by province code"0434"
getBarangayscitymunCodestringGet all barangays by city/municipality'043424'

Sample

import {
  IRegion,
  getRegions,
  IProvince,
  getProvinces,
  ICityMun,
  getCityMuns,
  IBarangay,
  getBarangays,
} from '@efdiaz/psgc';

// Get all regions
const regions: IRegion[] = getRegions();

// Get all the province of the selected region
const REGIN_IV_PROVINCES: IProvince[] = getProvinces('04');

// Get all the cities/municipalities of the selected province
const LAGUNA_MUNICIPALITIES_CITIES: ICityMun[] = getCityMuns('0434');

// Get all the barangays of the selected city/municipality
const SAN_PABLO_CITY_BARANGAYS: IBarangay[] = getBarangays('043424');

Building

To build the library.

npx nx build psgc

Running unit tests

To execute the unit tests via Jest.

nx test psgc

Maintainers

Credits

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request