UNPKG

@tm11/mmgeo

Version:

A comprehensive package providing states, districts, and townships data for Myanmar in both English and Myanmar languages.

55 lines (54 loc) 1.91 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Township = exports.District = exports.initialize = exports.getStates = void 0; const db_json_1 = __importDefault(require("../data/db.json")); const utils_1 = require("./utils"); class Township { constructor(en, mm) { this.en = en; this.mm = mm; } getName() { return (0, utils_1.getName)(this); } } exports.Township = Township; class District { constructor(en, mm, townships) { this.en = en; this.mm = mm; this.townships = townships; } getName() { return (0, utils_1.getName)(this); } getTownships() { return this.townships.map(township => new Township(township.en, township.mm)); } } exports.District = District; class State { constructor(en, mm, lat, lng, capital, districts) { this.en = en; this.mm = mm; this.lat = lat; this.lng = lng; this.capital = capital; this.districts = districts; } getName() { return (0, utils_1.getName)(this); } getDistricts() { return this.districts.map(district => new District(district.en, district.mm, district.townships.map(township => new Township(township.en, township.mm)))); } } const getStates = () => { return db_json_1.default.states.map(state => new State(state.eng, state.mm, state.lat, state.lng, state.capital, state.districts.map(district => new District(district.eng, district.mm, district.townships.map(township => new Township(township.eng, township.mm)))))); }; exports.getStates = getStates; var hook_1 = require("./hook"); Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return hook_1.initialize; } });