formatLaPoste関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Writes an address in France as La Poste's specification asks (SP 8855): the person it is care of, then the line of the
apartment, the floor and the staircase, the line of the entrance and the building, the number and street, the
lieu-dit and the box, then the postcode, the commune and its CEDEX, each on its own line, in capitals without accents
or punctuation. The arrondissement of Paris, Lyon or Marseille is not written when there is a postcode, which carries
it (75008 PARIS, as La Poste's own list has it); without one it is written in two digits (PARIS 08).
インポート
import { formatLaPoste } from "@johnmorrisdotca/address-plus/fr";
定義
function formatLaPoste(address: ParsedAddress, options?: LaPosteFormattingOptions): FormattedAddress
引数
| 名前 | 型 | 説明 |
|---|---|---|
address | ParsedAddress | The address as |
options (省略可) | LaPosteFormattingOptions | Whether to add the country, and whether to keep accents (see |
戻り値
FormattedAddress
The lines, the same on one line, the delivery line (the number and street) and the last line.
例
import { formatLaPoste, parseFrenchAddress } from "@johnmorrisdotca/address-plus/fr";
const parsedAddress1=parseFrenchAddress("Apt 12, Résidence Les Lilas, 4 bis av. des Écoles, 31000 Toulouse");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatLaPoste(parsedAddress1).lines);
// → ["APPARTEMENT 12","RESIDENCE LES LILAS","4 BIS AVENUE DES ECOLES","31000 TOULOUSE"][
'APPARTEMENT 12',
'RESIDENCE LES LILAS',
'4 BIS AVENUE DES ECOLES',
'31000 TOULOUSE'
]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。