monagree-locs 2.0.1 → 2.0.2

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/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # Monagree Location Picker
2
-
3
- To install, run:
4
-
5
- > npm install monagree-locs
6
-
7
- > Now Shows all countries
8
-
9
- > Only showing states & cities in Nigeria for now
10
-
11
- Please enjoy this accurate & up-to-date location package from the open source team at Monagree. Monagree provides tools for devs to build ecommerce and logistics websites easily. Check out our javascript framework (CLI) on npm [monagree-tools](https://www.npmjs.com/package/monagree-tools "Monagree JS Framework").
12
-
13
- ## Become a Monagree Developer
14
-
1
+ # Monagree Location Picker
2
+
3
+ To install, run:
4
+
5
+ > npm install monagree-locs
6
+
7
+ > Now Shows all countries
8
+
9
+ > Only showing states & cities in Nigeria for now
10
+
11
+ Please enjoy this accurate & up-to-date location package from the open source team at Monagree. Monagree provides tools for devs to build ecommerce and logistics websites easily. Check out our javascript framework (CLI) on npm [monagree-tools](https://www.npmjs.com/package/monagree-tools "Monagree JS Framework").
12
+
13
+ ## Become a Monagree Developer
14
+
15
15
  Start using awesome tools developed by Monagree to build cool ecommerce and logistics apps & Websites. Join now at [Monagree For Developers](https://developers.monagree.com "Monagree Developer Dashboard")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monagree-locs",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "All countries + States and LGAs in Nigeria (with GPS coordinates)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/dist/classes.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export interface mlocData {
2
- name: string;
3
- center: {
4
- lat: string;
5
- lon: string;
6
- };
7
- }
8
- export declare class mLoc {
9
- id: string;
10
- data: mlocData;
11
- constructor(id: string, data: mlocData);
12
- getId(): string;
13
- getName(): string;
14
- getLatitude(): string;
15
- getLongitude(): string;
16
- }
package/dist/classes.js DELETED
@@ -1,23 +0,0 @@
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.d.ts DELETED
@@ -1,46 +0,0 @@
1
- import { mLoc } from "./classes";
2
- export declare class mCountry {
3
- /**
4
- * Retrieves an array of all countries (Only supports Nigeria for now).
5
- * Set oderedList to true if you want the data ordered
6
- *
7
- * @returns {mLoc[]} An array of mLoc objects representing countries.
8
- */
9
- static getAllCountries(oderedList?: boolean): mLoc[];
10
- /**
11
- * Retrieves a country by its code
12
- *
13
- * @returns {mLoc}
14
- */
15
- static getCountryByCode(countryCode: string): mLoc | undefined;
16
- }
17
- export declare class mState {
18
- /**
19
- * Retrieves an array of all states in the provided country code.
20
- * Set oderedList to true if you want the data ordered
21
- *
22
- * @returns {mLoc[]} An array of mLoc objects representing states.
23
- */
24
- static getStatesByCountry(countryCode: string, oderedList?: boolean): mLoc[];
25
- /**
26
- * Retrieves a state by its code and countryCode
27
- *
28
- * @returns {mLoc}
29
- */
30
- static getStateByCode(countryCode: string, stateCode: string): mLoc | undefined;
31
- }
32
- export declare class mLga {
33
- /**
34
- * Retrieves an array of all LGAs in the specified country & state.
35
- * Set oderedList to true if you want the data ordered
36
- *
37
- * @returns {mLoc[]} An array of mLoc objects representing LGAs.
38
- */
39
- static getLgasByState(countryCode: string, stateCode: string, oderedList?: boolean): mLoc[];
40
- /**
41
- * Retrieves an LGA by its code, state code and country code
42
- *
43
- * @returns {mLoc}
44
- */
45
- static getLgaByCode(countryCode: string, stateCode: string, lgaCode: string): mLoc | undefined;
46
- }
package/dist/index.js DELETED
@@ -1,150 +0,0 @@
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
- /**
10
- * Retrieves an array of all countries (Only supports Nigeria for now).
11
- * Set oderedList to true if you want the data ordered
12
- *
13
- * @returns {mLoc[]} An array of mLoc objects representing countries.
14
- */
15
- mCountry.getAllCountries = function (oderedList) {
16
- var countries = [];
17
- for (var countryCode in locs_1.locs) {
18
- if (locs_1.locs.hasOwnProperty(countryCode)) {
19
- var acountry = locs_1.locs[countryCode];
20
- var country = {
21
- name: acountry.name,
22
- center: acountry.center
23
- };
24
- countries.push(new classes_1.mLoc(countryCode, country));
25
- }
26
- }
27
- if (oderedList) {
28
- return countries.slice().sort(function (a, b) { return a.getName().localeCompare(b.getName()); });
29
- }
30
- return countries;
31
- };
32
- /**
33
- * Retrieves a country by its code
34
- *
35
- * @returns {mLoc}
36
- */
37
- mCountry.getCountryByCode = function (countryCode) {
38
- if (locs_1.locs[countryCode]) {
39
- var acountry = locs_1.locs[countryCode];
40
- var country = {
41
- name: acountry.name,
42
- center: acountry.center
43
- };
44
- return new classes_1.mLoc(countryCode, country);
45
- }
46
- return undefined;
47
- };
48
- return mCountry;
49
- }());
50
- exports.mCountry = mCountry;
51
- var mState = /** @class */ (function () {
52
- function mState() {
53
- }
54
- /**
55
- * Retrieves an array of all states in the provided country code.
56
- * Set oderedList to true if you want the data ordered
57
- *
58
- * @returns {mLoc[]} An array of mLoc objects representing states.
59
- */
60
- mState.getStatesByCountry = function (countryCode, oderedList) {
61
- var states = [];
62
- if (locs_1.locs[countryCode]) {
63
- var nLoc = locs_1.locs[countryCode]['states'];
64
- for (var stateCode in nLoc) {
65
- if (nLoc.hasOwnProperty(stateCode)) {
66
- var astate = nLoc[stateCode];
67
- var state = {
68
- name: astate.name,
69
- center: astate.center
70
- };
71
- states.push(new classes_1.mLoc(stateCode, state));
72
- }
73
- }
74
- }
75
- if (oderedList) {
76
- return states.slice().sort(function (a, b) { return a.getName().localeCompare(b.getName()); });
77
- }
78
- return states;
79
- };
80
- /**
81
- * Retrieves a state by its code and countryCode
82
- *
83
- * @returns {mLoc}
84
- */
85
- mState.getStateByCode = function (countryCode, stateCode) {
86
- if (locs_1.locs[countryCode]) {
87
- var nLoc = locs_1.locs[countryCode]['states'];
88
- if (nLoc && nLoc[stateCode]) {
89
- var astate = nLoc[stateCode];
90
- var state = {
91
- name: astate.name,
92
- center: astate.center
93
- };
94
- return new classes_1.mLoc(stateCode, state);
95
- }
96
- }
97
- return undefined;
98
- };
99
- return mState;
100
- }());
101
- exports.mState = mState;
102
- var mLga = /** @class */ (function () {
103
- function mLga() {
104
- }
105
- /**
106
- * Retrieves an array of all LGAs in the specified country & state.
107
- * Set oderedList to true if you want the data ordered
108
- *
109
- * @returns {mLoc[]} An array of mLoc objects representing LGAs.
110
- */
111
- mLga.getLgasByState = function (countryCode, stateCode, oderedList) {
112
- var lgas = [];
113
- if (locs_1.locs[countryCode]) {
114
- var nLoc = locs_1.locs[countryCode]['states'];
115
- if (nLoc && nLoc[stateCode]) {
116
- var nnLoc = nLoc[stateCode]['lgas'];
117
- for (var lgaCode in nnLoc) {
118
- if (nnLoc.hasOwnProperty(lgaCode)) {
119
- var lga = nnLoc[lgaCode];
120
- lgas.push(new classes_1.mLoc(lgaCode, lga));
121
- }
122
- }
123
- }
124
- }
125
- if (oderedList) {
126
- return lgas.slice().sort(function (a, b) { return a.getName().localeCompare(b.getName()); });
127
- }
128
- return lgas;
129
- };
130
- /**
131
- * Retrieves an LGA by its code, state code and country code
132
- *
133
- * @returns {mLoc}
134
- */
135
- mLga.getLgaByCode = function (countryCode, stateCode, lgaCode) {
136
- if (locs_1.locs[countryCode]) {
137
- var nLoc = locs_1.locs[countryCode]['states'];
138
- if (nLoc && nLoc[stateCode]) {
139
- var nnLoc = nLoc[stateCode]['lgas'];
140
- if (nnLoc && nnLoc[lgaCode]) {
141
- var lga = nnLoc[lgaCode];
142
- return new classes_1.mLoc(lgaCode, lga);
143
- }
144
- }
145
- }
146
- return undefined;
147
- };
148
- return mLga;
149
- }());
150
- exports.mLga = mLga;
package/dist/locs.d.ts DELETED
@@ -1,28 +0,0 @@
1
- export interface LocsMap {
2
- [key: string]: {
3
- name: string;
4
- center: {
5
- lat: string;
6
- lon: string;
7
- };
8
- states?: {
9
- [key: string]: {
10
- name: string;
11
- center: {
12
- lat: string;
13
- lon: string;
14
- };
15
- lgas?: {
16
- [key: string]: {
17
- name: string;
18
- center: {
19
- lat: string;
20
- lon: string;
21
- };
22
- };
23
- };
24
- };
25
- };
26
- };
27
- }
28
- export declare const locs: LocsMap;