JSPM

indiankit

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

A Node.js package for Indian address parsing, phone validation, PIN code validation, and geocoding

Package Exports

  • indiankit
  • indiankit/src/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 (indiankit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

indiaKit

A Node.js package for Indian address parsing, phone validation, PIN code validation, and geocoding.

Installation

npm install indiankit

usage

const { parseIndianAddress, validateIndianPhone, validatePincode, geocodeAddress } = require('indiankit');

// 1. Parse an Indian address
const address = 'Flat 4B, Green Park, New Delhi, Delhi 110001';
console.log(parseIndianAddress(address));
// Output:
// {
//   rawAddress: 'Flat 4B, Green Park, New Delhi, Delhi 110001',
//   pincode: '110001',
//   state: 'Delhi',
//   city: 'New Delhi'
// }

// 2. Validate an Indian phone number
console.log(validateIndianPhone('+919876543210')); // true
console.log(validateIndianPhone('123456789'));    // false

// 3. Validate a PIN code
validatePincode('110001').then(result => {
  console.log(result);
  // {
  //   valid: true,
  //   details: {
  //     pincode: '110001',
  //     city: 'New Delhi Central',
  //     state: 'Delhi',
  //     locality: 'Baroda House'
  //   }
  // }
});

// 4. Geocode an address
geocodeAddress('Mumbai, Maharashtra, India').then(result => {
  console.log(result);
  // {
  //   latitude: 19.054999,
  //   longitude: 72.8692035,
  //   displayName: 'Mumbai Suburban, Maharashtra, India'
  // }
});