kramank
v0.1.0
Published
Zero-dependency validators for Indian GSTIN, PAN, IFSC, and pincode formats — checksum-verified, TypeScript-first.
Maintainers
Readme
kramank
Zero-dependency validators for Indian identifiers: GSTIN, PAN, IFSC, and pincode. Checksum-verified where a checksum exists (GSTIN), TypeScript-first, works in Node, browsers, and edge runtimes (no Node built-ins used).
Format validation only. These functions check that a string is a well-formed GSTIN/PAN/IFSC/pincode. They do not confirm the value is real, active, or currently registered with GSTN, the Income Tax Department, or a bank — that requires a live lookup against those systems, which this package does not do.
Install
npm install kramankUsage
import { validateGstin, validatePan, validateIfsc, validatePincode } from 'kramank';
validateGstin('27AAPFU0939F1ZV');
// {
// valid: true,
// input: '27AAPFU0939F1ZV',
// errors: [],
// warnings: [],
// stateCode: '27',
// state: 'Maharashtra',
// category: 'REGULAR',
// pan: 'AAPFU0939F',
// panEntityType: 'Firm',
// note: 'Format check only — does not confirm this value is real, active, or currently registered.'
// }
validatePan('ABCPD1234E');
// { valid: true, entityType: 'Individual', ... }
validateIfsc('HDFC0001234');
// { valid: true, bankCode: 'HDFC', ... }
validatePincode('110001');
// { valid: true, zoneDigit: '1', zone: 'Northern Region — ...', ... }Every validator returns the same shape — never a bare boolean:
interface ValidationResult {
valid: boolean;
input: string; // trimmed, normalized
errors: { code: string; message: string }[];
warnings: { code: string; message: string }[];
// ...plus decoded fields specific to each identifier
}So a failed validation always tells you why (errors[0].code), not just that it failed.
What this package does not do
- No network calls, no live registry lookups, no "is this GSTIN actually registered" check.
- No maintained reference data for IFSC branches or pincode post offices — just the structural/zone rules encoded in the formats themselves.
The hosted Kramank API
Kramank (क्रमांक, "number") is a hosted API that builds on these same validators and adds what a pure format check can't give you:
- IFSC lookup — real bank, branch, and address data for a given IFSC code, kept up to date.
- Pincode lookup — real post office, district, and state data for a given pincode.
- The same GSTIN/PAN/IFSC/pincode format validation as this package, as a hosted endpoint — useful if you'd rather not vendor the logic at all.
See the API reference for endpoints and free-tier limits, or get a key directly on RapidAPI — BASIC (free, 500 requests/month) and PRO ($9/month, 50,000 requests/month) are both live.
License
MIT
