1.0.9 • Published 4 months ago

state_city_pincode v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

state_city_pincode

state_city_pincode is a Node.js library that provides a simple way to retrieve a list of pincodes based on the provided state and city.

Installation

You can install the Pincode Lookup library using npm:

npm install state_city_pincode

Usage

Here's how you can use the Pincode Lookup library in your Node.js application:

const {pincodeList} = require("state_city_pincode");

// Use the pincodeList function to retrieve pincodes
function lookupPincodes(state, city) {
    try {
        const pincodes = pincodeList(state, city);
        console.log(`Pincodes for ${city}, ${state}:`, pincodes);
    } catch (error) {
        console.error("Error:", error.message);
    }
}

// Example usage:
lookupPincodes("Karnataka", "Bengaluru");
const {stateCityName} = require("state_city_pincode");

// Use the pincodeLookup function to retrieve pincodes
function lookupStateCity(pincode) {
    try {
        const stateCity = stateCityName(pincode);
        console.log(stateCity);
    } catch (error) {
        console.error("Error:", error.message);
    }
}

// Example usage:
lookupStateCity(560103);
const {getStates} = require("state_city_pincode");

// Use the pincodeLookup function to retrieve pincodes
function states() {
    try {
        console.log(getStates())
    } catch (error) {
        console.error("Error:", error.message);
    }
}

// Example usage:
states();
const {getCities} = require("state_city_pincode");

// Use the pincodeLookup function to retrieve pincodes
function cities(state) {
    try {
        console.log(getCities(state))
    } catch (error) {
        console.error("Error:", error.message);
    }
}

// Example usage:
cities();

API

pincodeLookup(state, city) 1. state (string): The state for which you want to fetch pincodes. 2. city (string): The city within the state for which you want to fetch pincodes. Returns a promise that resolves to an array of pincodes corresponding to the provided state and city. If no pincodes are found, an empty array is returned.

Acknowledgments

This library uses data from https://data.opendatasoft.com/explore/dataset/geonames-postal-code%40public/?sort=-latitude for pincode information.

Contact

If you have any questions or suggestions, please feel free to contact us.

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago