india-state-city 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 +41 -0
- package/lib/assets/city.json +29696 -0
- package/lib/assets/country.json +20 -0
- package/lib/assets/state.json +254 -0
- package/lib/city.d.ts +8 -0
- package/lib/city.js +48 -0
- package/lib/cjs/assets/city.json +29696 -0
- package/lib/cjs/assets/country.json +20 -0
- package/lib/cjs/assets/state.json +254 -0
- package/lib/cjs/city.d.ts +8 -0
- package/lib/cjs/city.js +53 -0
- package/lib/cjs/country.d.ts +8 -0
- package/lib/cjs/country.js +18 -0
- package/lib/cjs/index.d.ts +5 -0
- package/lib/cjs/index.js +10 -0
- package/lib/cjs/interface.d.ts +12 -0
- package/lib/cjs/interface.js +2 -0
- package/lib/cjs/state.d.ts +8 -0
- package/lib/cjs/state.js +36 -0
- package/lib/cjs/utils/index.d.ts +4 -0
- package/lib/cjs/utils/index.js +22 -0
- package/lib/country.d.ts +8 -0
- package/lib/country.js +13 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +3 -0
- package/lib/interface.d.ts +12 -0
- package/lib/interface.js +1 -0
- package/lib/state.d.ts +8 -0
- package/lib/state.js +28 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +16 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# india-state-city
|
|
2
|
+
|
|
3
|
+
A lightweight library to get the list of States in India and Cities within those States.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install india-state-city
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Get all States of India
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const { State } = require('india-state-city');
|
|
17
|
+
|
|
18
|
+
const states = State.getAllStates();
|
|
19
|
+
console.log(states);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Get Cities of a State
|
|
23
|
+
|
|
24
|
+
You need to provide the `stateCode` (e.g., 'MH' for Maharashtra, 'DL' for Delhi).
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
const { City } = require('india-state-city');
|
|
28
|
+
|
|
29
|
+
const cities = City.getCitiesOfState('MH');
|
|
30
|
+
console.log(cities);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### State
|
|
36
|
+
- `getAllStates()`: Returns an array of all states in India.
|
|
37
|
+
- `getStateByCode(stateCode)`: Returns details of a specific state by its code.
|
|
38
|
+
|
|
39
|
+
### City
|
|
40
|
+
- `getAllCities()`: Returns an array of all cities in India.
|
|
41
|
+
- `getCitiesOfState(stateCode)`: Returns an array of cities for a given state code.
|