knowindia
is an npm package that provides detailed information about Indian states and union territories. This package allows you to easily access and retrieve data related to each state and union territory in India.
To install the knowindia
package, use npm:
npm install knowindia
Package Manager | Command |
---|---|
Yarn | yarn add knowindia |
PNPM | pnpm add knowindia |
BUN | bun add knowindia |
Once you have installed the package, you can import it into your JavaScript file and use the provided functions to access data.
Importing the Package
- For projects using CommonJS, you can also import it as follows:
const { states, uts, India, INDIA } = require('knowindia');
- For projects using ES6 modules, you can also import it as follows:
import { states, uts, India, INDIA } from 'knowindia';
Returns an object containing data for all Indian states.
const allStates = states();
console.log(allStates);
Returns an object containing data for all Union Territories in India.
const allUTs = uts();
console.log(allUTs);
Returns a combined object that includes data for both states and UTs.
const indiaData = INDIA();
console.log(indiaData);
Returns the IndiaData object. The structure and data should be defined in India.js.
const indiaDetails = India();
console.log(indiaDetails);
You can also access specific state or UT data directly by referencing their keys.
const Delhi = uts().DL; // Access Delhi data
console.log(Delhi);
For projects using CommonJS, you can also import it as follows:
const { states, uts, India, INDIA } = require('knowindia');
For projects using ES6 modules, you can also import it as follows:
import { states, uts, India, INDIA } from 'knowindia';
console.log(states()); // Logs all states data
console.log(uts()); // Logs all union territories data
console.log(INDIA()); // Logs combined data for states and UTs
const Maharashtra = states().MH; // Access data for Maharashtra
console.log(Maharashtra);
- Andaman and Nicobar Islands: AN
- Chandigarh: CH
- Dadra and Nagar Haveli and Daman and Diu: DN
- Lakshadweep: LD
- Delhi: DL
- Puducherry: PY
- Jammu and Kashmir: JK
- Ladakh: LA
- Andhra Pradesh: AP
- Arunachal Pradesh: AR
- Assam: AS
- Bihar: BR
- Chhattisgarh: CG
- Goa: GA
- Gujarat: GJ
- Haryana: HR
- Himachal Pradesh: HP
- Jharkhand: JH
- Karnataka: KA
- Kerala: KL
- Madhya Pradesh: MP
- Maharashtra: MH
- Manipur: MN
- Meghalaya: ML
- Mizoram: MZ
- Nagaland: NL
- Odisha: OD
- Punjab: PB
- Rajasthan: RJ
- Sikkim: SK
- Tamil Nadu: TN
- Telangana: TG
- Tripura: TR
- Uttar Pradesh: UP
- Uttarakhand: UK
- West Bengal: WB
Contributions to the knowindia
package are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.