Use PK Validate in your app
Lightweight format validation for Pakistani identifiers and mobile numbers.
Validate regional identifiers
Import the helper modules you need. Use isValid for a boolean check and normalize or format when you need a canonical representation.
The module exports are cnic, phone, ntn, postalCode, and iban. Normalization/formatting helpers return null when they cannot produce a valid normalized value.
The examples use the package's documented API and synthetic values. Do not treat a successful format check as proof that a record is registered or belongs to the user.
| Method / field | Type | Notes |
|---|---|---|
cnic.normalize(value) | string | null | Canonical CNIC display form when the input has a supported shape. |
cnic.mask(value) | string | null | Masks the seven middle digits for safer display. |
phone.normalize(value) | string | null | E.164-like Pakistani number form, such as +923xxxxxxxxx. |
iban.isValid(value) | boolean | Checks the Pakistani IBAN structure and standard mod-97 checksum. |