npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bharat-ui/validators

v0.1.5

Published

Indian-context validators for PAN, Aadhaar, IFSC, Pincode and INR formatting. Zero dependencies. TypeScript-first. Works in React, React Native, and Node.js.

Readme

@bharat-ui/validators

Indian-context validators for PAN, Aadhaar, IFSC, Pincode and INR formatting.
Zero dependencies. TypeScript-first. Works in React, React Native, and Node.js.

Install

npm install @bharat-ui/validators

Usage

import { validatePAN, validateAadhaar, validateIFSC, validatePincode, formatINR } from '@bharat-ui/validators';

validatePAN('ABCPE1234F');
// { valid: true, formatted: 'ABCPE1234F', meta: { type: 'Individual', typeCode: 'P' } }

validateAadhaar('2341 2341 2346');
// { valid: true, formatted: '2341 2341 2346', masked: 'XXXX XXXX 2346' }

validateIFSC('SBIN0001234');
// { valid: true, formatted: 'SBIN0001234', meta: { code: 'SBIN0001234', bank: 'State Bank of India', ... } }

validatePincode('390001');
// { valid: true, formatted: '390001', meta: { pincode: '390001', district: 'Vadodara', state: 'Gujarat', zone: 'Western', headPO: 'Vadodara HO' } }

formatINR(1234567);         // '₹12,34,567'
formatINRCompact(1234567);  // '₹12.35L'

API

validatePAN(pan: string): PANResult

Validates a Permanent Account Number. Infers taxpayer type from the 4th character.
Case-insensitive — spaces stripped automatically.

interface PANResult {
  valid: boolean;
  formatted: string;   // 'ABCPE1234F' — empty string on failure
  error?: string;
  meta?: {
    type: string;      // 'Individual' | 'Company' | 'HUF' | 'Firm' | 'Trust' | ...
    typeCode: string;  // 'P' | 'C' | 'H' | 'F' | 'T' | ...
  };
}

validateAadhaar(aadhaar: string): AadhaarResult

Validates a 12-digit Aadhaar number using the Verhoeff checksum algorithm.
Spaces and hyphens stripped automatically.

interface AadhaarResult {
  valid: boolean;
  formatted: string;  // '2341 2341 2346' — empty string on failure
  masked?: string;    // 'XXXX XXXX 2346' — only present on valid input
  error?: string;
}

validateIFSC(ifsc: string): IFSCResult

Validates an 11-character IFSC code against the bundled RBI dataset.
Returns full bank and branch metadata — no network calls.

interface IFSCResult {
  valid: boolean;
  formatted: string;  // 'SBIN0001234' — empty string on failure
  error?: string;
  meta?: {
    code: string;
    bank: string;
    branch: string;
    address: string;
    city: string;
    state: string;
    contact: string;
  };
}

validatePincode(pincode: string): PincodeResult

Validates a 6-digit Indian pincode against the bundled India Post dataset.
Returns district, state, zone and head post office — no network calls.

interface PincodeResult {
  valid: boolean;
  formatted: string;  // '390001' — empty string on failure
  error?: string;
  meta?: {
    pincode: string;
    district: string;
    state: string;
    zone: string;
    headPO: string;
  };
}

formatINR(amount: number): string

Formats a number using the Indian numbering system (lakhs, crores) with the ₹ symbol.

formatINR(1234567)    // '₹12,34,567'
formatINR(100)        // '₹100'

formatINRCompact(amount: number): string

Compact Indian number formatting with L (lakh) and Cr (crore) suffixes.

formatINRCompact(1234567)    // '₹12.35L'
formatINRCompact(12345678)   // '₹1.23Cr'
formatINRCompact(999)        // '₹999'

parseINR(formatted: string): number

Strips ₹ symbol and commas, returns the raw number.

parseINR('₹12,34,567')  // 1234567

License

MIT