monagree-locs 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes.js +23 -1
- package/dist/index.js +96 -1
- package/dist/locs.js +5744 -1
- package/package.json +1 -1
package/dist/classes.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mLoc = void 0;
|
|
4
|
+
var mLoc = /** @class */ (function () {
|
|
5
|
+
function mLoc(id, data) {
|
|
6
|
+
this.id = id;
|
|
7
|
+
this.data = data;
|
|
8
|
+
}
|
|
9
|
+
mLoc.prototype.getId = function () {
|
|
10
|
+
return this.id;
|
|
11
|
+
};
|
|
12
|
+
mLoc.prototype.getName = function () {
|
|
13
|
+
return this.data.name;
|
|
14
|
+
};
|
|
15
|
+
mLoc.prototype.getLatitude = function () {
|
|
16
|
+
return this.data.center.lat;
|
|
17
|
+
};
|
|
18
|
+
mLoc.prototype.getLongitude = function () {
|
|
19
|
+
return this.data.center.lon;
|
|
20
|
+
};
|
|
21
|
+
return mLoc;
|
|
22
|
+
}());
|
|
23
|
+
exports.mLoc = mLoc;
|
package/dist/index.js
CHANGED
|
@@ -1 +1,96 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mLga = exports.mState = exports.mCountry = void 0;
|
|
4
|
+
var classes_1 = require("./classes");
|
|
5
|
+
var locs_1 = require("./locs");
|
|
6
|
+
var mCountry = /** @class */ (function () {
|
|
7
|
+
function mCountry() {
|
|
8
|
+
}
|
|
9
|
+
mCountry.getAllCountries = function () {
|
|
10
|
+
var countries = [];
|
|
11
|
+
for (var countryCode in locs_1.locs) {
|
|
12
|
+
if (locs_1.locs.hasOwnProperty(countryCode)) {
|
|
13
|
+
var country = locs_1.locs[countryCode];
|
|
14
|
+
delete country['states'];
|
|
15
|
+
countries.push(new classes_1.mLoc(countryCode, country));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return countries;
|
|
19
|
+
};
|
|
20
|
+
mCountry.getCountryByCode = function (countryCode) {
|
|
21
|
+
if (locs_1.locs[countryCode]) {
|
|
22
|
+
var country = locs_1.locs[countryCode];
|
|
23
|
+
delete country['states'];
|
|
24
|
+
return new classes_1.mLoc(countryCode, country);
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
};
|
|
28
|
+
return mCountry;
|
|
29
|
+
}());
|
|
30
|
+
exports.mCountry = mCountry;
|
|
31
|
+
var mState = /** @class */ (function () {
|
|
32
|
+
function mState() {
|
|
33
|
+
}
|
|
34
|
+
mState.getStatesByCountry = function (countryCode) {
|
|
35
|
+
var states = [];
|
|
36
|
+
if (locs_1.locs[countryCode]) {
|
|
37
|
+
var nLoc = locs_1.locs[countryCode]['states'];
|
|
38
|
+
for (var stateCode in nLoc) {
|
|
39
|
+
if (nLoc.hasOwnProperty(stateCode)) {
|
|
40
|
+
var state = nLoc[stateCode];
|
|
41
|
+
delete state['lgas'];
|
|
42
|
+
states.push(new classes_1.mLoc(stateCode, state));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return states;
|
|
47
|
+
};
|
|
48
|
+
mState.getStateByCode = function (countryCode, stateCode) {
|
|
49
|
+
if (locs_1.locs[countryCode]) {
|
|
50
|
+
var nLoc = locs_1.locs[countryCode]['states'];
|
|
51
|
+
if (nLoc && nLoc[stateCode]) {
|
|
52
|
+
var state = nLoc[stateCode];
|
|
53
|
+
delete state['lgas'];
|
|
54
|
+
return new classes_1.mLoc(stateCode, state);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
};
|
|
59
|
+
return mState;
|
|
60
|
+
}());
|
|
61
|
+
exports.mState = mState;
|
|
62
|
+
var mLga = /** @class */ (function () {
|
|
63
|
+
function mLga() {
|
|
64
|
+
}
|
|
65
|
+
mLga.getLgasByState = function (countryCode, stateCode) {
|
|
66
|
+
var lgas = [];
|
|
67
|
+
if (locs_1.locs[countryCode]) {
|
|
68
|
+
var nLoc = locs_1.locs[countryCode]['states'];
|
|
69
|
+
if (nLoc && nLoc[stateCode]) {
|
|
70
|
+
var nnLoc = nLoc[stateCode]['lgas'];
|
|
71
|
+
for (var lgaCode in nnLoc) {
|
|
72
|
+
if (nnLoc.hasOwnProperty(lgaCode)) {
|
|
73
|
+
var lga = nnLoc[lgaCode];
|
|
74
|
+
lgas.push(new classes_1.mLoc(lgaCode, lga));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return lgas;
|
|
80
|
+
};
|
|
81
|
+
mLga.getLgaByCode = function (countryCode, stateCode, lgaCode) {
|
|
82
|
+
if (locs_1.locs[countryCode]) {
|
|
83
|
+
var nLoc = locs_1.locs[countryCode]['states'];
|
|
84
|
+
if (nLoc && nLoc[stateCode]) {
|
|
85
|
+
var nnLoc = nLoc[stateCode]['lgas'];
|
|
86
|
+
if (nnLoc && nnLoc[lgaCode]) {
|
|
87
|
+
var lga = nnLoc[lgaCode];
|
|
88
|
+
return new classes_1.mLoc(lgaCode, lga);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
};
|
|
94
|
+
return mLga;
|
|
95
|
+
}());
|
|
96
|
+
exports.mLga = mLga;
|