Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

Reference · French country module

LaPosteFormattingOptionstype

Options for formatLaPoste.

Import it

import type { LaPosteFormattingOptions } from "@johnmorrisdotca/address-plus/fr";

Definition

interface LaPosteFormattingOptions {
    includeCountry?: boolean;
    keepAccents?: boolean;
}

Members

NameTypeDescription
includeCountry (optional)boolean | undefined
keepAccents (optional)boolean | undefined

Examples

import { formatLaPoste, parseFrenchAddress } from "@johnmorrisdotca/address-plus/fr";
import type { LaPosteFormattingOptions } from "@johnmorrisdotca/address-plus/fr";

const parsedAddress1=parseFrenchAddress("12 rue de la Paix, 75002 Paris");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatLaPoste(parsedAddress1, { includeCountry: true }).lines);
// → ["12 RUE DE LA PAIX","75002 PARIS","FRANCE"]
[ '12 RUE DE LA PAIX', '75002 PARIS', 'FRANCE' ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.