digipinjs
Version:
A comprehensive TypeScript library for encoding and decoding Indian geographic coordinates into DIGIPIN format (Indian Postal Digital PIN system). Features CLI tools, caching, batch processing, and Express middleware for seamless integration.
26 lines (25 loc) • 800 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCached = getCached;
exports.setCached = setCached;
exports.clearCache = clearCache;
exports.reverseGeocode = reverseGeocode;
const lru_cache_1 = __importDefault(require("lru-cache"));
const cache = new lru_cache_1.default({ max: 10000 });
function getCached(lat, lng) {
return cache.get(`${lat},${lng}`);
}
function setCached(lat, lng, pin) {
cache.set(`${lat},${lng}`, pin);
}
function clearCache() {
cache.clear();
}
// src/reverseGeocode.ts
const core_1 = require("./core");
function reverseGeocode(pin) {
return (0, core_1.getLatLngFromDigiPin)(pin);
}