@efdiaz/psgc
v1.0.3
Published
Philippine Standard Geographic Code (PSGC)
Downloads
14
Maintainers
Readme
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
| Method | Param | Type | Description | Example |
| -------------- | ----------- | ------ | ---------------------------------------------- | -------- |
| getRegions
| | | Get all the regions |
| getProvinces
| regCode | string | Get all province by region code | "04" |
| getCityMuns
| provCode | string | Get all cities/municipalities by province code | "0434" |
| getBarangays
| citymunCode | string | Get 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
- Arnel Clave - for providing the JSON data
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request