TypeScript API reference
Every function, type and option in the pakdatakit npm package, generated from its source and doc comments. 91 functions in 32 modules. Everything is exported from pakdatakit; each module is also its own entry point (for example pakdatakit/cnic) if you want to import less.
import { validateCNIC, formatPhone } from 'pakdatakit';
validateCNIC('42101-1234567-1'); // trueformatPhone('03001234567'); // '+923001234567'Looking for a function by name? Press / or Ctrl K to search. New here? Start with the install guide or the module guides, which have examples in all five languages.
Identity and contact
Check and format the numbers people type into sign-up and KYC forms.
- CNIC
pakdatakit/cnicValidate and format CNIC numbers; read the province and gender they encode.2 functions · 1 interface - Phone
pakdatakit/phoneValidate, format and analyse mobile numbers in every common way they are written.5 functions · 1 interface - Networks
pakdatakit/networksFind the mobile network (Jazz, Zong, Telenor, Ufone…) from a number prefix.1 function · 1 type - Landlines and number types
pakdatakit/numbersTell mobile, landline, toll-free and UAN numbers apart; look up area codes.4 functions · 1 interface · 1 type - WhatsApp
pakdatakit/whatsappBuild wa.me links with an optional pre-filled message.1 function - Passport
pakdatakit/passportCheck the format of a Pakistani passport number.1 function - As-you-type input
pakdatakit/inputFormat CNIC, phone and IBAN fields while the user types, and say what is missing.6 functions · 1 type
Banking and payments
Bank accounts, Raast QR codes and utility bills.
- IBAN and banks
pakdatakit/ibanValidate IBANs (with the check digits) and find the bank they belong to.4 functions · 1 interface · 1 type - Raast QR
pakdatakit/raastCreate and read Raast person-to-person and merchant QR payloads.4 functions · 7 interfaces · 3 types - Utility bills
pakdatakit/billsParse electricity reference numbers and check gas consumer numbers.3 functions · 1 interface · 2 types
Tax and invoicing
Sales tax, income tax on salaries, NTN and FBR digital invoices.
- Sales tax
pakdatakit/salestaxFederal and provincial sales tax rates by date; add tax or split it out.3 functions · 4 interfaces · 1 type - Income tax on salary
pakdatakit/incometaxAnnual and monthly tax on salaries under each Finance Act.5 functions · 4 interfaces - NTN and STRN
pakdatakit/taxValidate and analyse NTN and STRN numbers.3 functions · 1 interface · 1 type - FBR digital invoicing
pakdatakit/fbr-invoiceBuild and check invoices for the FBR digital invoicing API.3 functions · 7 interfaces · 4 types · 1 constant
Places and addresses
Provinces, districts, cities, postal codes, couriers and vehicle plates.
- Provinces, districts and cities
pakdatakit/geoSearch cities and districts; get divisions, tehsils and provinces.9 functions - Postal codes
pakdatakit/postalPostal codes for cities and post offices, and the reverse.7 functions · 1 interface - Addresses
pakdatakit/addressParse a free-text address into parts and format it back.2 functions · 1 interface - Couriers
pakdatakit/courierMap courier tracking statuses to one set; match city names to each courier.2 functions · 2 types - Vehicle plates
pakdatakit/vehicleParse and validate vehicle registration plates.2 functions · 1 interface
Text, numbers and dates
Urdu text, amounts in words, rupee formatting and the Hijri calendar.
- Urdu and Roman Urdu text
pakdatakit/textNormalise text, convert digits, slugify, compare Urdu and handle right-to-left.8 functions · 1 interface · 2 types - Amounts in words
pakdatakit/wordsWrite numbers and rupee amounts in words (lakh and crore).2 functions · 2 interfaces · 1 type - Rupee formatting
pakdatakit/formatFormat amounts as PKR with lakh and crore grouping.4 functions · 1 interface - Hijri calendar
pakdatakit/hijriConvert to and from Hijri dates; month names and Ramadan.5 functions · 2 interfaces - Public holidays
pakdatakit/holidaysPakistan’s public holidays for a year or a date.3 functions · 2 interfaces · 2 types
Data quality
Score the data you already have, and see which data version you ship.
Schema adapters
The validators as ready-made rules for your schema library. Import from pakdatakit/<library>.
- Zod
pakdatakit/zodZod schemas for CNIC, phone, IBAN and more.1 interface · 1 constant - Valibot
pakdatakit/valibotValibot actions for the same checks.1 constant - Yup
pakdatakit/yupYup tests for the same checks.1 constant - Joi
pakdatakit/joiA Joi extension with the same checks.1 constant - Superstruct
pakdatakit/superstructSuperstruct refinements for the same checks.1 constant - class-validator
pakdatakit/class-validatorDecorators for class-validator.1 type · 11 constants