parseBrazilianAddress関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Parses an address in Brazil into the parts the Correios lay out: who it is care of (careOf), the street as written with its
type (street: Avenida Paulista, R. Augusta), its number (number: 1578, S/N), the complement (secUnitType and
secUnitNum: Apto 45, Sala 12; building for a bloco or a torre; floorType Andar and floor), the bairro in
locality, the city in city, the CEP in zip (written 01310-200) and the state's code in state (SP), as written or
from the CEP. The number follows the street after a comma or not, and the bairro after a hyphen or a comma.
インポート
import { parseBrazilianAddress } from "@johnmorrisdotca/address-plus/br";
定義
function parseBrazilianAddress(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 BR, or null when the text is empty or holds nothing that makes it an address.
例
import { parseBrazilianAddress } from "@johnmorrisdotca/address-plus/br";
console.log(parseBrazilianAddress("Avenida Paulista, 1578 - Bela Vista, São Paulo - SP, 01310-200"));
// → {"number":"1578","street":"Avenida Paulista","locality":"Bela Vista","city":"São Paulo","state":"SP","zip":"01310-200","zipValid":true,"country":"BR"}{
number: '1578',
street: 'Avenida Paulista',
locality: 'Bela Vista',
city: 'São Paulo',
state: 'SP',
zip: '01310-200',
zipValid: true,
country: 'BR'
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。