lanka-validations - v2.1.0
    Preparing search index...

    Function lookupPostalCode

    • Looks up district, province, and primary city for a Sri Lankan 5-digit postal code. Returns PostalCodeInfo or null if not a recognized postal code range.

      Parameters

      • code: unknown

        Postal code to look up.

      Returns PostalCodeInfo | null

      District, province, and (for selected cities) the city, or null if the prefix is unknown.

      lookupPostalCode('20000')?.district; // 'Kandy'
      lookupPostalCode('00100')?.primaryCity; // 'Colombo 01 (Fort)'