1.0.0 • Published 3 years ago

zipcodes-ph2 v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

zipcodes-ph

Travis Codecov version downloads license

Philippines zip code directory.

Installation

Install via npm:

$ npm install --save zipcodes-ph

Browser builds are also available inside the build directory or in unpkg.com.

Usage

NodeJS:

const zipcodes = require('zipcodes-ph');

zipcodes.find(6000); // 'Cebu City'
zipcodes.reverse('Cebu City'); // 6000

Browser:

<script src="path/to/zipcodes-ph/build/index.umd.min.js"></script>
// global variable `zipcodesPH` is exposed

zipcodesPH.find(6000); // 'Cebu City'
zipcodesPH.reverse('Cebu City'); // 6000

API

  • find(zipcode)

    • zipcode (Number|String): The zip code that will be resolved into a location name.
    • possible return values:
      • String if one location with the zip code is found.
      • Array if multiple locaitons with the zip code are found.
      • null if no locations with the zip code are found.
  • reverse(location)

    • location (String): The name of the location that will be resolved into a zip code.
    • possible return values:
      • Number if zip code for the location is found.
      • null if zip code for the location is not found.

License

MIT License