1.0.5 • Published 2 years ago

indian_places v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Indian Places

List of india places including pincode. Demo

Installation

npm i indian_places

Example

const ip = require("indian_places");

// To get the states
const states = ip.getStates();

// To get the district of a state
const westBengal = states.find((item) => item.name === "West Bengal");
const districtsOfWb = westBengal.getDistricts();

// To get places of a specific district
const north24Pgs = districtsOfWb.find(
  (item) => item.name === "North 24 parganas"
);
const places = north24Pgs.getPlaces();

// To get places by pincode
// This function will return empty array if that pincode doesn't exists
const places = ip.getPlacesByPin(743271);

Functions

To get place data, package contains essential functions which will help you to retrive exact place from mapped data. I described little bit about object types below.

func()parameterreturns
getStates()NoneArray of State Obj
getDistricts_by_state()State - objArray of District Obj
getPlaces_by_district()District - objArray of Place Obj
getPlacesByPin()pincode - numberArray of State Obj

Objects

State Object

memberdescription
nameState name
getDistricts()Method to get districts of that state

District Object

memberdescription
nameDistrict name
stateState name of that district
getPlaces()Method to get places of that district

Place Object

memberdescription
namePlace name
districtDistrict name of that place
stateState name of that place
pinPincode of that place

At last

If you like this wrapper package please give this repo a star :)

Credits, India gov data portal