parseFrenchAddress関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Parses an address in France (or Monaco, or an overseas department or collectivity, which are written the same way)
into the parts La Poste's norm names: who it is care of (careOf), an apartment or a door (secUnitType,
secUnitNum), a floor, a staircase, an entrance, the building or residence (building), the number with its
extension (numberExtension: bis, ter, a letter), the type of voie in full in type and its name in street
(rue de la Paix is Rue and de la Paix), a lieu-dit, a box (BP 12, CS 30001), the commune in city with
its arrondissement and CEDEX, and the postcode in zip with the department's code in state. The postcode may
stand anywhere after the street; F-75008 is read as 75008.
インポート
import { parseFrenchAddress } from "@johnmorrisdotca/address-plus/fr";
定義
function parseFrenchAddress(text: string, options?: ParseOptions): ParsedAddress | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | The address as one string; commas and line breaks both separate its parts. |
options (省略可) | ParseOptions |
|
戻り値
ParsedAddress | null
The parts found, with country FR (or MC or a collectivity's code), or null when the text is empty
or holds nothing that makes it an address.
例
import { parseFrenchAddress } from "@johnmorrisdotca/address-plus/fr";
console.log(parseFrenchAddress("Résidence Les Lilas, 12 bis rue de la Paix, 75002 Paris"));
// → {"building":"Résidence Les Lilas","number":"12","numberExtension":"bis","type":"Rue","street":"de la Paix","city":"Paris","state":"75","zip":"75002","zipValid":true,"country":"FR"}{
building: 'Résidence Les Lilas',
number: '12',
numberExtension: 'bis',
type: 'Rue',
street: 'de la Paix',
city: 'Paris',
state: '75',
zip: '75002',
zipValid: true,
country: 'FR'
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。