nepal_political
Version:
This npm package has details about Nepal Political Administrative Info
60 lines (59 loc) • 2.13 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Nepal_json_1 = __importDefault(require("../data/Nepal.json"));
/**
* Represents a collection of functions related to political divisions in Nepal.
*/
exports.default = {
/**
* Retrieves the list of provinces in Nepal.
* @returns An array of province names.
*/
Province: function Province() {
const statesSet = new Set();
Nepal_json_1.default.map(i => {
statesSet.add(i.state);
});
return Array.from(statesSet);
},
/**
* Retrieves the list of districts in a specific province.
* @param provinceName - The name of the province.
* @returns An array of district names.
*/
DistrictByProvince: function DistrictByProvince(provinceName) {
const districtSet = new Set();
Nepal_json_1.default.map(i => {
if (i.state === provinceName) {
districtSet.add(i.district);
}
});
return Array.from(districtSet);
},
/**
* Retrieves the list of local bodies in a specific district.
* @param districtName - The name of the district.
* @returns An array of local body names.
*/
LocalBodiesByDistrict: function LocalBodiesByDistrict(districtName) {
const localBodiesSet = new Set();
Nepal_json_1.default.map(i => {
if (i.district === districtName) {
localBodiesSet.add(i.localbody);
}
});
return Array.from(localBodiesSet);
},
/**
* Retrieves the list of ward details for a specific municipality.
* @param municipalityName - The name of the municipality.
* @returns An array of ward numbers.
*/
WardDetails: function WardDetails(municipalityName) {
const localBody = Nepal_json_1.default.find(i => i.localbody === municipalityName);
return localBody ? Array.from(new Set(localBody.ward)) : [];
}
};