JSPM

pincode-distance-mapping

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q10555F
    • License ISC

    A simple Node.js package to calculate the distance (in km) between two Indian pincodes using the Nominatim OpenStreetMap API.

    Package Exports

    • pincode-distance-mapping
    • pincode-distance-mapping/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pincode-distance-mapping) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    pincode-distance-mapping

    A simple Node.js package to calculate the distance (in km) between two pincodes using the Nominatim OpenStreetMap API. This package is ideal for React, Angular, Node.js, and other JavaScript-based projects.

    Features

    ✅ Fetches latitude & longitude from a pincode
    ✅ Uses the Haversine formula to calculate distances
    ✅ Works with any JavaScript/Node.js project
    ✅ Lightweight and easy to use

    Installation

    You can install this package using NPM:

      npm install pincode-distance-mapping

    Usage/Examples

    1. Import the package

    In Node.js
    const { getDistance, getCoordinates } = require('pincode-distance-mapping');
    
    In ES Modules:
    import { getDistance, getCoordinates } from 'pincode-distance-mapping';

    2. Get Distance Between Two Pincodes

    (async () => {
      const distance = await getDistance("110001", "400001"); // Example: Delhi to Mumbai
      console.log("Distance:", distance);
    })();

    getDistance(Source Pincode, Destination Pincode);