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

ng-bharat-validators

v1.0.2

Published

Angular reactive form validators for Indian formats — PAN, Aadhaar, GSTIN, IFSC, Pincode, Mobile and more. Also works in React, Vue, and Node.js.

Readme

ng-bharat-validators

npm version license types

Angular reactive form validators for Indian formats — PAN, Aadhaar, GSTIN, IFSC, Pincode, Mobile and more. Also works in React, Vue, and Node.js.

Installation

npm install ng-bharat-validators

Usage in Angular

import { BharatValidators } from 'ng-bharat-validators';

this.form = this.fb.group({
  pan:     ['', [Validators.required, BharatValidators.pan()]],
  aadhaar: ['', [Validators.required, BharatValidators.aadhaar()]],
  gstin:   ['', [Validators.required, BharatValidators.gstin()]],
  ifsc:    ['', [Validators.required, BharatValidators.ifsc()]],
  pincode: ['', [Validators.required, BharatValidators.pincode()]],
  mobile:  ['', [Validators.required, BharatValidators.mobile()]],
  upi:     ['', [BharatValidators.upi()]],
});

Show error messages in template

<input formControlName="pan" />
<span *ngIf="form.get('pan')?.errors?.['pan']">
  {{ form.get('pan')?.errors?.['pan']?.message }}
</span>

Usage in React / Vue / Node.js

import { BharatUtils } from 'ng-bharat-validators';

BharatUtils.isValidPAN('ABCDE1234F')        // true
BharatUtils.isValidAadhaar('234567890124')  // true  (valid Verhoeff check digit)
BharatUtils.isValidGSTIN('27ABCDE1234F1Z0') // true  (valid checksum)
BharatUtils.isValidIFSC('SBIN0005943')      // true
BharatUtils.isValidPincode('411001')        // true
BharatUtils.isValidIndianMobile('9876543210') // true

All Validators

| Validator | Angular | Raw | |---|---|---| | PAN card | BharatValidators.pan() | isValidPAN() | | Aadhaar | BharatValidators.aadhaar() | isValidAadhaar() | | GSTIN | BharatValidators.gstin() | isValidGSTIN() | | IFSC | BharatValidators.ifsc() | isValidIFSC() | | Pincode | BharatValidators.pincode() | isValidPincode() | | Mobile | BharatValidators.mobile() | isValidIndianMobile() | | Vehicle number | BharatValidators.vehicleNumber() | isValidVehicleNumber() | | Voter ID | BharatValidators.voterId() | isValidVoterID() | | Passport | BharatValidators.passport() | isValidPassport() | | UPI ID | BharatValidators.upi() | isValidUPI() | | Driving license | BharatValidators.drivingLicense() | isValidDrivingLicense() |

Why this package

  • Works directly with Angular FormBuilder — no wrapper code needed
  • Real checksum validation for Aadhaar (Verhoeff) and GSTIN (mod-36), not just format matching — catches typos and made-up numbers
  • Every error includes a human-readable message property
  • Privacy-safe errors — the raw value you typed is never copied into the error object, so PAN/Aadhaar numbers don't leak into logs or error trackers
  • Handles lowercase, spaces, +91 prefix automatically
  • Works in React, Vue, Node.js via BharatUtils
  • Full TypeScript support with autocomplete
  • Hardened against ReDoS (input length capped) — malicious input always returns false, never throws

Format vs. real-document validation — please read

This library checks that a value is well-formed and internally consistent (correct shape, and a valid checksum where one exists). It does not prove that a document actually exists or belongs to a person.

  • ✅ Great for: instant client-side UX feedback, catching typos before submit, basic data hygiene.
  • ❌ Not a substitute for: real KYC / identity verification. For that, always verify server-side against the issuing authority (UIDAI, GSTN, RBI, etc.).

Validators with checksums: Aadhaar (Verhoeff), GSTIN (mod-36 + state-code range). All others are format/syntax checks.

Standalone checksum helpers

import { isAadhaarChecksumValid, isGstinChecksumValid } from 'ng-bharat-validators';

isAadhaarChecksumValid('234567890124')  // true
isGstinChecksumValid('27ABCDE1234F1Z0') // true

Author

Sanket Jain

License

MIT