@efdiaz/psgc
Version:
Philippine Standard Geographic Code (PSGC)
50 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBarangays = exports.getCityMuns = exports.getProvinces = exports.getRegions = void 0;
/**
* Load the JSON data
*/
const regJSON = require("./data/refregion.json");
const provJSON = require("./data/refprovince.json");
const citymunJSON = require("./data/refcitymun.json");
const brgyJSON = require("./data/refbrgy.json");
const regions = regJSON;
const provinces = provJSON;
const citymuns = citymunJSON;
const barangays = brgyJSON;
/**
*
* @returns Lists of Regions
*/
function getRegions() {
return regions;
}
exports.getRegions = getRegions;
/**
*
* @param regCode Region Code
* @returns Lists of Provinces by Region
*/
function getProvinces(regCode) {
return provinces.filter((province) => province.regCode === regCode);
}
exports.getProvinces = getProvinces;
/**
*
* @param provCode Province Code
* @returns Lists of Cities/Municipalities by Province
*/
function getCityMuns(provCode) {
return citymuns.filter((citymuns) => citymuns.provCode === provCode);
}
exports.getCityMuns = getCityMuns;
/**
*
* @param citymunCode City/Municipality Code
* @returns Lists of Barangays by City/Municipality
*/
function getBarangays(citymunCode) {
return barangays.filter((brgy) => brgy.citymunCode === citymunCode);
}
exports.getBarangays = getBarangays;
//# sourceMappingURL=psgc.js.map