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

FrenchPostcodetype

A postcode taken apart: the code of the department or territory its number belongs to, the country it delivers to, and whether La Poste's base has it. place is a department's code (75, 2A, 971), a collectivity's (987) or 99 for Monaco.

Import it

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

Also exported from: @johnmorrisdotca/address-plus

Definition

interface FrenchPostcode {
    postcode: string;
    place: string;
    country: FrenchPostalCountry;
    known: boolean;
    department?: string;
}

Members

NameTypeDescription
postcodestring
placestring
countryFrenchPostalCountry
knownboolean
department (optional)string | undefined

Examples

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

console.log(parseFrenchPostcode("20200"));
// → {"postcode":"20200","place":"2B","country":"FR","known":true,"department":"2B"}
{
  postcode: '20200',
  place: '2B',
  country: 'FR',
  known: true,
  department: '2B'
}

What it prints (run when this page was built)

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