Code Monkey home page Code Monkey logo

indian_places's Introduction

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() parameter returns
getStates() None Array of State Obj
getDistrictsByState() State - obj Array of District Obj
getPlacesByDistrict() District - obj Array of Place Obj
getPlacesByPin() pincode - number Array of State Obj

Objects

State Object

member description
name State name
getDistricts() Method to get districts of that state

District Object

member description
name District name
state State name of that district
getPlaces() Method to get places of that district

Place Object

member description
name Place name
district District name of that place
state State name of that place
pin Pincode of that place

At last

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

Credits, India gov data portal

indian_places's People

Contributors

dni9 avatar epicx67 avatar swapnilsoni1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.