Skip to content

pakdatakit 2.3.0

pakdatakit 2.3.0

Breaking for TypeScript exhaustive switches

Section titled “Breaking for TypeScript exhaustive switches”
  • BankType has a new member, 'public-sector' (see Data below). Code that switches over every BankType and checks exhaustiveness (for example with a never default, or @typescript-eslint/switch-exhaustiveness-check) stops compiling until it handles the new value. Nothing else changes at runtime for such code, but National Bank of Pakistan, Sindh Bank, The Bank of Khyber and The Bank of Punjab now report 'public-sector' instead of 'commercial'.
  • Form adapters for Joi (pakdatakit/joi), Superstruct (pakdatakit/superstruct) and class-validator (pakdatakit/class-validator). The class-validator decorators (IsCNIC, IsPakPhone, IsPakIBAN, IsNTN, IsSTRN, IsPakLandline, IsPakPassport, IsVehiclePlate) work in NestJS DTOs without a NestJS dependency. All three libraries are optional peer dependencies.
  • validatePassport() (pakdatakit/passport): format check for Pakistani passport numbers (two letters, seven digits). DGIP does not publish the format, so this checks the common shape only; see DATA.md.
  • validateVehiclePlate() and parseVehiclePlate() (pakdatakit/vehicle): series, number and optional year of a vehicle registration number. Each province sets its own format, so this accepts the shape they share (1–4 letters, 1–4 digits); see DATA.md.
  • pk.passport() and pk.vehiclePlate() in every form adapter.
  • getPostOffice(code) and searchPostOffices(query) (pakdatakit/postal): every delivery post office in Pakistan Post’s directory (about 2,560), as { code, office, town, district, province }, including offices in towns and villages that getCityByPostalCode does not cover. The directory is in its own data file, so it only lands in bundles that call these two functions.
  • Divisions and tehsils from the 2023 census (pakdatakit/geo): getDivisions(province?), getDivisionOfDistrict(district), getTehsils(district) and getTehsilDistrict(tehsil, province?). The data is the census’s 30 divisions and 591 tehsils, talukas and sub-divisions. Each tehsil is recorded under its 2023 census district; for districts created since, see the census-district note in the README and DATA.md.

November 2026 audit against official sources (see AUDIT.md and DATA.md). dataVersion is now 2026-11-17.

  • Banks: added ZTBL (Zarai Taraqiati Bank Limited) and SMFB (Sindh Microfinance Bank), both from IBANs printed by the State Bank. TMFB and TAMW are now named “Easypaisa Bank Limited” and JCMA and WMBL “Mobilink Microfinance Bank (JazzCash)”, the names on the State Bank’s lists.
  • Postal codes: eight codes were a nearby office’s, not the city’s own, and are corrected from Pakistan Post’s directory: Gilgit 15100, Dera Ismail Khan 29050, Tank 29400, Badin 72200, Thatta 73130, Sujawal 73050, Matiari 70150 and Taxila 47080. 47040, which was listed for Taxila, is Wah Cantt GPO and now returns Wah Cantonment. Three office names are corrected (Saidu Sharif GPO, Qila Sheikhupura GPO, University New Campus Jamshoro).
  • Holidays: seven source links for 2024 to 2026 now point to the Cabinet Division notification or State Bank circular instead of a news report. No dates changed.
  • Postal codes from Pakistan Post’s directory: postal-codes.json now holds every office in the directory that belongs to a city on pakdatakit’s city list: 457 codes instead of 110. getCityByPostalCode keeps its meaning (a city, or null) and now knows 355 more codes; getPostalCode has a code for 63 more cities; getPostalCodes, getPostalAreas and searchPostalCodes return more for cities with several offices (Lahore 5 → 50, Karachi 11 → 58, Islamabad 1 → 46); and parseAddress can fill in the city from these codes. Entries also carry province and, for district headquarters, district. Offices in other towns and villages are in the new post-offices.json (getPostOffice). Compared with 2.2.1, getCityByPostalCode gives a different answer for eight codes, all corrected in this release: 47040 is Wah Cantonment (was Taxila), and 15700, 29120, 29430, 70100, 72220, 73020 and 73220, which were given as the main code of a city but belong to a village office nearby, now return null.
  • Area codes: 41 more landline area codes from the numbering plan PTA filed with the ITU: 18 in Balochistan, 8 in Khyber Pakhtunkhwa and the 15 four-digit codes of Azad Jammu and Kashmir and Gilgit-Baltistan (05822 Muzaffarabad, 05811 Gilgit). Numbers in these codes already validated; analyzeNumber now also returns their area code and district, and getAreaCode finds them.
  • Bank types: new type public-sector for the State Bank’s “public sector commercial banks”: National Bank of Pakistan (NBPA, NBPB), Sindh Bank, The Bank of Khyber and The Bank of Punjab. They were commercial before; filter on both if you list commercial banks.
  • SME Bank (SMES) is now “SME Bank Limited (in liquidation)” with active: false: the State Bank cancelled its licence and de-scheduled it in March 2025.
  • Subpath imports such as pakdatakit/zod or pakdatakit/class-validator now get their types under TypeScript’s older moduleResolution: "node", the default for "module": "commonjs" projects (including many NestJS apps). They only resolved with node16, nodenext or bundler before.
  • The README’s “Why PakDataKit?” section compares PakDataKit with a typical hand-written regex, and the npm description and keywords cover all modules.

The Python and Dart packages get the same passport and vehicle plate functions in 2.3.0, checked against the shared test vectors.

pakdatakit 2.3.0

  • validate_passport(): format check for Pakistani passport numbers (two letters, seven digits). DGIP does not publish the format, so this checks the common shape only.
  • validate_vehicle_plate() and parse_vehicle_plate(): series, number and optional year of a vehicle registration number (1–4 letters, 1–4 digits). Provinces use different formats, so this checks the shape they share.
  • Both are checked against the shared test vectors, like the rest of the package. See DATA.md in the repository for sources and limits.

Data (November 2026 audit, see AUDIT.md and DATA.md in the repository): banks ZTBL (Zarai Taraqiati Bank Limited) and SMFB (Sindh Microfinance Bank) added; TMFB/TAMW renamed “Easypaisa Bank Limited” and JCMA/WMBL “Mobilink Microfinance Bank (JazzCash)”; eight postal codes corrected from Pakistan Post’s directory (Gilgit, Dera Ismail Khan, Tank, Badin, Thatta, Sujawal, Matiari, Taxila) and Wah Cantonment 47040 added; holiday source links for 2024 to 2026 now point to official notifications.

Data depth:

  • get_divisions(), get_division_of_district(), get_tehsils() and get_tehsil_district(): division and tehsil lookups from the 2023 census (30 divisions, 591 tehsils). Each tehsil is recorded under its census district.
  • get_post_office() and search_post_offices(): every delivery post office in Pakistan Post’s directory (about 2,560), as PostOffice(code, office, town, district, province), including offices in towns and villages.
  • get_city_by_postal_code() still returns a city or None, and only for post offices in a city on pakdatakit’s city list: 457 codes instead of 110. The code of an office in another town or village returns None; use get_post_office() for those. get_postal_code(), get_postal_codes(), get_postal_areas() and search_postal_codes() return more for cities with several offices.
  • Compared with 2.2.1, get_city_by_postal_code() gives a different answer for eight codes: 47040 is Wah Cantonment (was Taxila), and 15700, 29120, 29430, 70100, 72220, 73020 and 73220, which were given as the main code of a city but belong to a village office nearby, now return None.
  • 41 more landline area codes.
  • New bank type public-sector. SME Bank (SMES) is reported as inactive.

DATA_VERSION is now 2026-11-17.

pakdatakit 2.3.0

  • BankType has a new value, BankType.publicSector ('public-sector'; see Data depth below). Dart 3 checks switch statements and expressions over an enum for exhaustiveness, so a switch over BankType without a default (_) case stops compiling until it handles the new value. Nothing else changes at runtime for such code, but National Bank of Pakistan, Sindh Bank, The Bank of Khyber and The Bank of Punjab now report BankType.publicSector instead of BankType.commercial.
  • validatePassport(): format check for Pakistani passport numbers (two letters, seven digits). DGIP does not publish the format, so this checks the common shape only. Also as package:pakdatakit/passport.dart.
  • validateVehiclePlate() and parseVehiclePlate(): series, number and optional year of a vehicle registration number (1–4 letters, 1–4 digits). Provinces use different formats, so this checks the shape they share. Also as package:pakdatakit/vehicle.dart.
  • getPostOffice() and searchPostOffices() (also in package:pakdatakit/postal.dart): every delivery post office in Pakistan Post’s directory (about 2,560), as PostOffice values (code, office, town, district, province), including offices in towns and villages that getCityByPostalCode does not cover. The directory is in its own source file and only these two functions reference it, so release builds that do not call them leave it out.
  • All of these are checked against the shared test vectors. See DATA.md in the repository for sources and limits.

Data (November 2026 audit, see AUDIT.md and DATA.md in the repository): banks ZTBL (Zarai Taraqiati Bank Limited) and SMFB (Sindh Microfinance Bank) added; TMFB/TAMW renamed “Easypaisa Bank Limited” and JCMA/WMBL “Mobilink Microfinance Bank (JazzCash)”; eight postal codes corrected from Pakistan Post’s directory (Gilgit, Dera Ismail Khan, Tank, Badin, Thatta, Sujawal, Matiari, Taxila) and Wah Cantonment 47040 added; holiday source links for 2024 to 2026 now point to official notifications.

Data depth:

  • getDivisions(), getDivisionOfDistrict(), getTehsils() and getTehsilDistrict(): division and tehsil lookups from the 2023 census (30 divisions, 591 tehsils). Each tehsil is recorded under its census district, so districts created since the census may list few or no tehsils and have no division.
  • Postal codes now hold every office in Pakistan Post’s directory that belongs to a listed city: 457 codes, up from 110. getCityByPostalCode still returns a listed city or null, so a village office’s code returns null (use getPostOffice for those). Compared with 2.2.1 it gives a different answer for eight codes: 47040 is Wah Cantonment (was Taxila), and 15700, 29120, 29430, 70100, 72220, 73020 and 73220, which were given as the main code of a city but belong to a village office nearby, now return null.
  • 41 more landline area codes.
  • BankType.publicSector ('public-sector') for public sector commercial banks; BankType.commercial now means private commercial banks.
  • SME Bank (SMES) is reported as inactive (active: false).

dataVersion is now 2026-11-17.

PakDataKit 2.3.0

First release of the .NET packages, matching version 2.3.0 of the pakdatakit npm package.

  • PakDataKit: every module of the npm package for .NET 8, with no dependencies: Cnic, Phone, Networks, Numbers, Iban, Tax, Passport, VehiclePlate, Postal, Geo, WhatsApp, Currency, Words, Text, Hijri, Holidays, Address, Input and RaastQr.
  • Checked against the TypeScript library with over 12,000 shared test cases, also used by the Python and Dart ports, so all four give the same results.
  • The datasets are embedded from the repository’s data/ folder at build time.
  • Postal.GetPostOffice(code) and Postal.SearchPostOffices(query): every delivery post office in Pakistan Post’s directory (about 2,560), as a PostOffice record (Code, Office, Town, District, Province), including offices in towns and villages that Postal.GetCity does not cover. The directory is parsed on first use only.
  • PakDataKit.DataAnnotations: [Cnic], [PakPhone], [PakIban], [Ntn], [Strn], [PakLandline], [PakPassport] and [VehiclePlate].
  • PakDataKit.FluentValidation: IsCnic(), IsPakPhone(), IsPakIban(), IsNtn(), IsStrn(), IsPakLandline(), IsPakPassport() and IsVehiclePlate().
  • No method throws for a string it is given to check: validators return false, parsers and lookups return null or an empty list, including for null, very long input and invalid Unicode. Try* overloads (Hijri.TryFromHijri, Holidays.TryGetHolidaysOn, WhatsApp.TryCreateLink, RaastQr.TryCreateP2P, RaastQr.TryCreateMerchant) cover the methods that throw for invalid arguments. A fuzz test checks the contract.

Data (November 2026 audit, see AUDIT.md and DATA.md in the repository): banks ZTBL (Zarai Taraqiati Bank Limited) and SMFB (Sindh Microfinance Bank) added; TMFB/TAMW renamed “Easypaisa Bank Limited” and JCMA/WMBL “Mobilink Microfinance Bank (JazzCash)”; eight postal codes corrected from Pakistan Post’s directory (Gilgit, Dera Ismail Khan, Tank, Badin, Thatta, Sujawal, Matiari, Taxila) and Wah Cantonment 47040 added; holiday source links for 2024 to 2026 now point to official notifications. Division and tehsil lookups from the 2023 census added (Geo.GetDivisions, Geo.GetDivisionOfDistrict, Geo.GetTehsils, Geo.GetTehsilDistrict): 30 divisions and 591 tehsils, each tehsil recorded under its census district. Postal.GetCity and the other Postal lookups now cover every office in Pakistan Post’s directory that belongs to a city on pakdatakit’s city list (457 codes instead of 110) and still return only listed cities; offices in other towns and villages are answered by Postal.GetPostOffice. Compared with npm 2.2.1, Postal.GetCity gives a different answer for eight codes: 47040 is Wah Cantonment (was Taxila), and 15700, 29120, 29430, 70100, 72220, 73020 and 73220, which were given as the main code of a city but belong to a village office nearby, now return null. 41 more landline area codes. New bank type public-sector (BankType.PublicSector): National Bank of Pakistan, Sindh Bank, The Bank of Khyber and The Bank of Punjab now report it instead of Commercial, and a switch expression over BankType without a discard arm now gets an exhaustiveness warning (CS8509) until it handles the new value. SME Bank (SMES) is reported as inactive. PakData.Version is now 2026-11-17.

chmuzamil/pakdatakit 2.3.0

First release of the PHP package, matching version 2.3.0 of the pakdatakit npm package.

  • Every module of the npm package for PHP 8.2+, with no dependencies beyond the mbstring extension: Cnic, Phone, Networks, Numbers, Iban, Tax, Passport, VehiclePlate, Postal, Geo, WhatsApp, Currency, Words, Text, Hijri, Holidays, Address, Input and RaastQr.
  • Checked against the TypeScript library with over 12,000 shared test cases, also used by the Python, Dart and .NET ports, so all give the same results.
  • Does not need the intl extension and does not depend on the locale: upper- and lower-casing, Unicode normalization, sort order and number formatting are built in.
  • No method throws for a string it is given to check: validators return false, parsers and lookups return null or an empty array, including for null, very long input and text that is not valid UTF-8. try* methods cover the ones that throw for invalid arguments.
  • Laravel 11 and 12 bridge, discovered automatically: pk_cnic, pk_phone, pk_iban, pk_ntn, pk_strn, pk_landline, pk_passport and pk_vehicle_plate rules, matching rule objects, CnicCast, PhoneCast and IbanCast Eloquent casts, and English and Urdu messages.
  • Postal::getPostOffice() and Postal::searchPostOffices(): every delivery post office in Pakistan Post’s directory (about 2,560) as a PostOffice (code, office, town, district, province), including offices in towns and villages. The directory is in its own data file, loaded only when these two methods are called.
  • Postal::getCity() and the other Postal methods cover only the post offices of the cities the package lists; a village code returns null from getCity() (use getPostOffice()). Compared with npm 2.2.1, getCity() gives a different answer for eight codes: 47040 is Wah Cantonment (was Taxila), and 15700, 29120, 29430, 70100, 72220, 73020 and 73220, which were given as the main code of a city but belong to a village office nearby, now return null.

Data (November 2026 audit, see AUDIT.md and DATA.md in the repository): banks ZTBL (Zarai Taraqiati Bank Limited) and SMFB (Sindh Microfinance Bank) added; TMFB/TAMW renamed “Easypaisa Bank Limited” and JCMA/WMBL “Mobilink Microfinance Bank (JazzCash)”; eight postal codes corrected from Pakistan Post’s directory (Gilgit, Dera Ismail Khan, Tank, Badin, Thatta, Sujawal, Matiari, Taxila) and Wah Cantonment 47040 added; holiday source links for 2024 to 2026 now point to official notifications. Also added: division and tehsil lookups from the 2023 census (30 divisions, 591 tehsils; each tehsil is recorded under its census district), the full Pakistan Post directory (about 2,560 post codes), 41 more landline area codes, the bank type public-sector, and SME Bank is reported as inactive. PakData::version() is now 2026-11-17.