@mohit_dev/india-location-master 0.0.0-stage β 1.0.0
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 +72 -2
- package/data/cities.json +1490376 -0
- package/data/districts.json +4320 -0
- package/data/states.json +38 -0
- package/package.json +29 -4
- package/src/index.js +268 -0
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mohit_dev/india-location-master
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lightweight, fast, and offline Node.js package providing complete master location data for **36 Indian States/UTs, 620 Districts, and 149,500+ Cities/Villages with PIN codes and Lat/Lng coordinates**.
|
|
4
|
+
|
|
5
|
+
## π Why use `@mohit_dev/india-location-master`?
|
|
6
|
+
|
|
7
|
+
- β‘ **Zero API / Server overhead** (Lightning fast execution)
|
|
8
|
+
- πΎ **No Database required** (No MongoDB/SQL setup needed)
|
|
9
|
+
- π **Works 100% Offline**
|
|
10
|
+
- πΊοΈ **Includes Lat & Lng Coordinates**
|
|
11
|
+
- π£οΈ **Includes Native/Official Languages**
|
|
12
|
+
- π **100% Free & Open Source**
|
|
13
|
+
- π **No API keys or rate limits**
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## π¦ Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @mohit_dev/india-location-master
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## π Usage
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const {
|
|
29
|
+
getStates,
|
|
30
|
+
getDistricts,
|
|
31
|
+
getCities,
|
|
32
|
+
getStateByName,
|
|
33
|
+
getDistrictByName,
|
|
34
|
+
searchCities,
|
|
35
|
+
getCitiesByPincode,
|
|
36
|
+
getLanguages,
|
|
37
|
+
getStatesByLanguage,
|
|
38
|
+
getAllLocations,
|
|
39
|
+
} = require("@mohit_dev/india-location-master");
|
|
40
|
+
|
|
41
|
+
// 1. Get all 36 States & UTs
|
|
42
|
+
console.log(getStates());
|
|
43
|
+
|
|
44
|
+
// 2. Get Districts by State ID (e.g., "MP" for Madhya Pradesh)
|
|
45
|
+
console.log(getDistricts("MP"));
|
|
46
|
+
|
|
47
|
+
// 3. Get Cities by District ID (e.g., "MP_indore")
|
|
48
|
+
console.log(getCities("MP_indore"));
|
|
49
|
+
|
|
50
|
+
// 4. Find State by Name or ID
|
|
51
|
+
console.log(getStateByName("Madhya Pradesh"));
|
|
52
|
+
|
|
53
|
+
// 5. Find District by Name (returns lat & lng)
|
|
54
|
+
console.log(getDistrictByName("Indore"));
|
|
55
|
+
|
|
56
|
+
// 6. Search Cities by name/substring (e.g., Mhow)
|
|
57
|
+
console.log(searchCities("mhow"));
|
|
58
|
+
|
|
59
|
+
// 7. Find Cities/Locations by PIN Code
|
|
60
|
+
console.log(getCitiesByPincode("453441"));
|
|
61
|
+
|
|
62
|
+
// 8. Get Native Languages for State or District
|
|
63
|
+
console.log(getLanguages("Maharashtra")); // ['Marathi']
|
|
64
|
+
|
|
65
|
+
// 9. Get States by Native Language
|
|
66
|
+
console.log(getStatesByLanguage("Bengali"));
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## π License
|
|
72
|
+
|
|
73
|
+
MIT
|