@harlandgomez/addresspinas

中文文档
2.1.4发布于 2020/10/21MITCommonJS零依赖近 30 天下载 4462

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.

原始使用文档
文档目录9 节
  1. What is this for?
  2. Fetch all information in an array.
  3. Get all Region's provinces
  4. Get all Province's cities and municipals
  5. Get all City/Municipal's barangays
  6. Get barangay's zipcode
  7. Properties and methods
  8. Credits
  9. License

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

PropertyTypeDescription
reg_codestringcode of a specific region which is used as a search parameter.
prov_codestringcode of a specific province which is used as a search parameter.
mun_codestringcode of a specific city or municipality which is used as a search parameter.
philData.allRegionsArrayList of all regions
philData.allProvincesArrayList of all provinces
philData.allCitiesAndMunicipalArrayList of all cities and municipals
philData.allBrgysArrayList of all barangays
getProvinceOfRegionFunctionGet all the provinces of a specific region. Parameter (reg_code)
getCityMunOfProvinceFunctionGet all the cities and municipalities of a specific province. Parameter (prov_code)
getBarangaysOfCityMunFunctionGet all the barangays of a specific city of municipality. Parameter (mun_code)
getZipcodeFunctionGet 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

版本与发布记录

@harlandgomez/addresspinas 共发布 2 个版本,首次发布于 2020/10/21;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.1.4latest2020/10/216 年前
2.1.32020/10/216 年前

关于 @harlandgomez/addresspinas 的常见问题

@harlandgomez/addresspinas 是什么?

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.

如何安装 @harlandgomez/addresspinas?

在项目目录运行 npm install @harlandgomez/addresspinas,或使用 pnpm add / yarn add / bun add。

@harlandgomez/addresspinas 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/harlandgomez__addresspinas 是否存在。

@harlandgomez/addresspinas 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@harlandgomez/addresspinas 可以商用吗?

@harlandgomez/addresspinas 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@harlandgomez/addresspinas 的下载量有多少?

根据 npm 官方下载统计,@harlandgomez/addresspinas 在 2026/10/17 – 2026/11/15 这 30 天内被下载 4,462 次,日均约 149 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@harlandgomez/addresspinas 还在维护吗?

最新版本 2.1.4 发布于 2020/10/21(6 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/10/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。