monagree-locs 1.0.1 → 1.0.3

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,5 +1,9 @@
1
1
  # Monagree Location Picker
2
2
 
3
+ To install, run:
4
+
5
+ > npm install monagree-locs
6
+
3
7
  > Only showing locations in Nigeria for now
4
8
 
5
9
  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").
@@ -0,0 +1,13 @@
1
+ interface stateData {
2
+ name: string;
3
+ center: {
4
+ lat: number;
5
+ lon: number;
6
+ };
7
+ }
8
+ export declare class mLoc {
9
+ id: string;
10
+ data: stateData;
11
+ constructor(id: string, data: stateData);
12
+ }
13
+ export {};
@@ -0,0 +1,11 @@
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
+ return mLoc;
10
+ }());
11
+ exports.mLoc = mLoc;
@@ -0,0 +1,3 @@
1
+ import { mLoc } from "./classes";
2
+ export declare function getAllStatesInNigeria(): mLoc[];
3
+ export declare function getLgasByState(stateCode: string): mLoc[];
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLgasByState = exports.getAllStatesInNigeria = void 0;
4
+ var classes_1 = require("./classes");
5
+ var locs_1 = require("./locs");
6
+ function getAllStatesInNigeria() {
7
+ var states = [];
8
+ for (var stateCode in locs_1.locs) {
9
+ if (locs_1.locs.hasOwnProperty(stateCode)) {
10
+ var state = locs_1.locs[stateCode];
11
+ delete state['lga'];
12
+ states.push(new classes_1.mLoc(stateCode, state));
13
+ }
14
+ }
15
+ return states;
16
+ }
17
+ exports.getAllStatesInNigeria = getAllStatesInNigeria;
18
+ function getLgasByState(stateCode) {
19
+ var lgas = [];
20
+ var state = locs_1.locs[stateCode];
21
+ if (state) {
22
+ for (var lgaCode in state['lgas']) {
23
+ if (state['lgas'].hasOwnProperty(lgaCode)) {
24
+ var lga = state['lgas'][lgaCode];
25
+ lgas.push(new classes_1.mLoc(lgaCode, lga));
26
+ }
27
+ }
28
+ }
29
+ return lgas;
30
+ }
31
+ exports.getLgasByState = getLgasByState;
package/dist/locs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const locs: any;