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

parseFrenchPostcodefunction

Takes a postcode apart: the code of the department or territory its number belongs to, and the country it delivers to (FR for France and its overseas departments, MC for Monaco, PF, NC and the other collectivities' own codes), and whether La Poste's base lists it. A few postcodes serve a commune across a department's border; the department reported is the one the number names.

Import it

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

Definition

function parseFrenchPostcode(postcode: string): FrenchPostcode | null

Parameters

NameTypeDescription
postcodestring

The postcode, with or without spaces.

Returns

FrenchPostcode | null

The parts, or null when it is not five digits.

Examples

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

console.log(parseFrenchPostcode("98714"));
// → {"postcode":"98714","place":"987","country":"PF","known":true}
{ postcode: '98714', place: '987', country: 'PF', known: true }

What it prints (run when this page was built)

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