pincode-lookup
v1.0.0
Published
Fast static pincode to district/state lookup for Indian pincodes
Downloads
38
Maintainers
Readme
pincode-lookup
Fast, dependency-free Indian pincode → district/state lookup.
Install
npm install pincode-lookupUsage
const { getDistrict, getState, getBoth, getAll, stats } = require('pincode-lookup');
getDistrict('505415'); // ['Jagitial', 'KARIMNAGAR', 'PEDDAPALLI']
getState('505415'); // 'TELANGANA'
getBoth('110003'); // [{ district: 'NEW DELHI', state: 'DELHI' }, ...]
getBoth('000000'); // nullWhen a pincode maps to more than one district, the functions return an array. For unambiguous pincodes a string or single object is returned.
Stats
- ~19,586 unique pincodes
- ~21,162 pincode → district/state mappings
- Lookup latency: ~100 ns/op
- Package size: ~68 KB gzipped
Data source
Derived from India Post office data.
