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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@harlandgomez/addresspinas

v2.1.4

Published

This is a simple node package for getting a list of Philippines's Regions, Provinces, Cities/Muninicapals and Barangays including zipcodes that could be useful for forms or other app functionality.

Downloads

4

Readme

AddressPinas

What is this for?

This is a simple javascript library for getting a list of Philippines's regions, provinces, cities/muninicapalities and barangays including zipcodes that could be useful for forms or other app functionality.

Installation

npm i addresspinas --save

Usage

import { allData, address } from 'addresspinas'

or..

const { allData, address } = require('addresspinas') 

Fetch all information in an array.

Returns an array of info.
const regions = philData.allRegions

const provinces = philData.allProvinces

const cityMunicipal = philData.allCitiesAndMunicipal

const brgy = philData.allBrgys

Fetching specific information

Codes needed to pass into the function
reg_code // use for fetching data connected to a region.
    {
        "name": "REGION VII (CENTRAL VISAYAS)",
        "reg_code": "07"
    }


prov_code // for fetching data connected to a province.
    {
        "name": "ORIENTAL MINDORO",
        "reg_code": "17",
        "prov_code": "1752"
    }

mun_code // for fetching data connected to a city or municipal.
    {
        "name": "LILOAN",
        "prov_code": "0864",
        "city_code": "086406"
    },

API

(Make sure that the data you pass into the function is a "string")

Get all Region's provinces

//address.getProvinceOfRegion(reg_code)

import {  address } from 'addresspinas'


const provinces = address.getProvinceOfRegion("07")

console.log(provinces)

//RETURNS

    name: 'REGION VII (CENTRAL VISAYAS)',
    provinces:
        [
            {
                name: 'BOHOL',
                reg_code: '07',
                prov_code: '0712'
            },
            {
                name: 'CEBU',
                reg_code: '07',
                prov_code: '0722'
            }
        ]

Get all Province's cities and municipals

import { address } from 'addresspinas'

const cities = address.getCityMunOfProvince("0722")

console.log(cities)

//RETURNS

    name: 'CEBU',
    cityOrMunicipal:
    [
        {
            name: 'ALCANTARA',
            prov_code: '0722',
            mun_code: '072201'
        },
        {
            name: 'ALCOY',
            prov_code: '0722',
            mun_code: '072202'
        }
    ]

Get all City/Municipal's barangays

import { address } from 'addresspinas'

const barangay = address.getBarangaysOfCityMun("072201")

console.log(barangay)

//RETURNS

    name: 'ALCANTARA',
    barangays:
    [
        {

            name: 'Cabadiangan',
            mun_code: '072201'
        },
        {
            brgyDesc: 'Cabil-isan',
            mun_code: '072201'
        }
    ]

Get barangay's zipcode

Returns result(s) as an array since there are places that do have a same name.
Disclaimer: If zipcode cannot be found by barangay it will automatically look for the municipal zipcode since most of the barangays in the province use municipal zipcode.
Example: There are 2 places in the philippines that are named Ramon Magsaysay. Therefore, It will return an array with 2 index in it.
import { address } from 'addresspinas'

const getZip = address.getZipcode({ name: 'Ramon Magsaysay', mun_code: '137404' })

console.log(getZip)

//RETURNS

   [ '1105', '7024' ]

Properties and methods

| Property | Type | Description | | ------------ | ------------ | ------------ | | reg_code | string | code of a specific region which is used as a search parameter. | | prov_code | string | code of a specific province which is used as a search parameter. | | mun_code | string | code of a specific city or municipality which is used as a search parameter. | | philData.allRegions | Array | List of all regions | | philData.allProvinces | Array | List of all provinces | | philData.allCitiesAndMunicipal | Array | List of all cities and municipals | | philData.allBrgys | Array | List of all barangays | | getProvinceOfRegion | Function | Get all the provinces of a specific region. Parameter (reg_code) | | getCityMunOfProvince | Function | Get all the cities and municipalities of a specific province. Parameter (prov_code)| | getBarangaysOfCityMun | Function | Get all the barangays of a specific city of municipality. Parameter (mun_code)| | getZipcode | Function | Get the barangay's zipcode initially using the name and if not found it will automatically use the municipal zipcode. Parameter (Object). example: { name: 'Ramon Magsaysay', mun_code: '137404' }|


Credits

National Statistical Coordination Board clavearnel ejcubillas

License

MIT