Reference · French country module
franceconstant
France's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with
France (or Monaco or an overseas territory), holds CEDEX, or has a French type of voie and a postcode first on its
last line is read as French; country: "FR" reads any address as one, and so does the code of an overseas department
or collectivity. It reads Monaco (MC) and the collectivities (PM, BL, MF, WF, PF, NC) too, and reports
their own codes.
Import it
import { france } from "@johnmorrisdotca/address-plus/fr";
Definition
const france: CountryModule = {
code: "FR",
codes: ["FR", "MC", "GP", "MQ", "GF", "RE", "YT", "PM", "BL", "MF", "WF", "PF", "NC"],
name: "France",
detect: looksFrench,
parse: parseFrenchAddress,
validate: validateFrenchAddress,
format: (address) => formatLaPoste(address),
compare: compareFrenchAddresses,
}
Members
| Name | Type | Description |
|---|---|---|
code | string | |
codes | readonly string[] | |
name | string | |
detect | (address: string): boolean | |
parse | (address: string, options?: ParseOptions): ParsedAddress | null | |
validate | (address: ParsedAddress, options?: ValidationOptions): CountryValidation | |
format | (address: ParsedAddress): FormattedAddress | |
compare | (first: ParsedAddress, second: ParsedAddress): CountryComparison |
Examples
import { parseLocation } from "@johnmorrisdotca/address-plus";
import { france } from "@johnmorrisdotca/address-plus/fr";
console.log(parseLocation("12 bis rue de la Paix, 75002 Paris, France", { countries: [france] })?.numberExtension);
// → "bis"bisWhat it prints (run when this page was built)