本文へ移動

address-plusアドレスプラス

住所を端末の中で解析・確認・整形・比較し、国のモジュールや任意のフォームの入力欄を使えます。

address-plusは、parse-addressの使い方を広げ、型付きの結果、確認、書式、国のモジュールを加えます。 名前について(英語)

目次

リファレンス · /br

looksBrazilian関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Whether an address is surely Brazilian, with no hint: it ends with Brazil, Brasil or BR, or with a CEP written with its hyphen (01310-200, five digits, a hyphen and three) in the range of a state, after the word CEP or a Brazilian state's code (SP). A bare number of that shape claims nothing: a US ZIP+4 has four digits after the hyphen and Portugal's has three before it, but other places may write five and three.

インポート

import { looksBrazilian } from "@johnmorrisdotca/address-plus/br";

定義

function looksBrazilian(text: string): boolean

引数

名前型説明
textstring

The address as one string.

戻り値

boolean

true when the address is Brazilian beyond doubt, false otherwise.

例

import { looksBrazilian } from "@johnmorrisdotca/address-plus/br";

console.log([looksBrazilian("Rua Augusta, 100, São Paulo - SP, 01305-000"), looksBrazilian("123 Main St, Seattle, WA 98101-1234")]);
// → [true,false]
[ true, false ]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/address-plus 1.10.2 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。