This module exports address field names for every country, in English. This is useful as many countries have subtle differences in field names (e.g. Postcode in the UK vs ZIP code in the US). It is based on the Oasis XAL standard for addresses.
The output is c.33kb (minified) with no dependencies, and it will work on both node & the browser. It also includes Typescript types for your convenience.
//...name: "United Kingdom"iso: "GB"fields:addressLine1: "Address 1"addressLine2: "Address 2"locality: "Town/city"administrativeArea: "County"postalCode: "Postcode"name: "United States"iso: "US"fields:addressLine1: "Address 1"addressLine2: "Address 2"locality: "City"administrativeArea: "State"postalCode: "ZIP code"//...;
Note that several fields are excluded from this array to save space, as they exist (and are named the same) for all countries. These are:
- sortingCode - Rarely used so this is omitted, but some regions use sorting code as well as postal code (often users will place this in address line 2 instead).
Get field names for a specific country
The module includes a few useful Typescript helpers:
- CountryCodes - ENUM with each 2-letter country code in capital letters
- AddressFields - Full OASIS XAL address field names interface
- CountryAddressDetails - The type exported by this module (as
Built by Skyhook
This module is contributed by the team at Skyhook