Skip to content

normalizeCityForCourier

function normalizeCityForCourier(input): string | null;

Defined in: courier.ts:242

Maps the way a customer or a courier writes a city to the city’s name in pakdatakit’s city list, so orders can be matched against a courier’s service list.

Accepts the exact name in any case, short forms (LHR, Khi, Pindi, Isb, FSD), the old name Lyallpur, a trailing “city”, and the main cities in Urdu script.

Parameter Type
input string

string | null

A city from the city list, or null. Never throws.

normalizeCityForCourier('LHR'); // "Lahore"
normalizeCityForCourier('lyallpur'); // "Faisalabad"
normalizeCityForCourier('Karachi City'); // "Karachi"
normalizeCityForCourier('Atlantis'); // null