Giter Site home page Giter Site logo

isaacdarcilla / select-philippines-address Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 10.0 1.83 MB

📍Promise-based address selection in the Philippines

Home Page: https://www.npmjs.com/package/select-philippines-address

JavaScript 100.00%
npm node ph philippines address select html react vue package

select-philippines-address's Introduction

Promised-based select addresses in the Philippines using HTML select tag base on address codes or location name.

js-standard-style npm version codecov

Demos

React JS

Deploy with Vercel

Vue JS

Deploy with Vercel

Installation

npm i select-philippines-address --save

Usage

import { regions, provinces, cities, barangays, regionByCode, provincesByCode, provinceByName } from "select-philippines-address";

regions().then((region) => console.log(region));
regionByCode("01").then((region) => console.log(region.region_name));
provinces("01").then((province) => console.log(province));
provincesByCode("01").then((province) => console.log(province));
provinceByName("Rizal").then((province) => console.log(province.province_code));
cities("0128").then((city) => console.log(city));
barangays("052011").then((barangays) => console.log(barangays));

Description

Function Parameters Description
regions() None Returns all regions.
regionByCode() region_code Returns a region by its code.
provinces() region_code Returns provinces in the specified region.
provincesByCode() region_code Returns provinces in the specified region.
provinceByName() province_name Returns a province by its name.
cities() province_code Returns cities in the specified province.
barangays() city_code Returns barangays in the specified city.

Demo Source Code

License

Apache-2.0

Contributors

select-philippines-address's People

Contributors

ccfiel avatar dependabot[bot] avatar isaacdarcilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

select-philippines-address's Issues

Delay of filling data for each location category

I noticed that when you won't be changing the value of a particular select tag (e.g., city), it wont set the value.

Example, when you choose a city that has "one" barangay only, of course you wont be opening the Select tag anymore since it is already pre-selected or pre-filled. I suggest trying this location, and try to log the variables from useState:

Region: Region I (Ilocos Region)
Province: Ilocos Norte
City: Adams
Barangay: Adams (Pob) ---> The only barangay of City of Adams

When you log the selected options, you will notice that the Barangay is blank since there's no way to reselect/reset it. Thus, the resulting log will be:

Region: Region I (Ilocos Region)
Province: Ilocos Norte
City: Adams
Barangay:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.