isValidUKPostcode関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether a postcode follows Royal Mail's grammar: one of the six shapes (M2 5BQ, M34 4AB, CR0 2YR, DN16 9AA,
W1A 4ZZ, EC1A 1HQ) with the letters each place allows, or GIR 0AA. Letter case and the space do not matter.
Whether the postcode is in use is a different question; parseUKPostcode and the validator also check its area
and district.
インポート
import { isValidUKPostcode } from "@johnmorrisdotca/address-plus/gb";
定義
function isValidUKPostcode(postcode: string): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
postcode | string | The postcode. |
戻り値
boolean
true when it has a postcode's shape and letters.
例
import { isValidUKPostcode } from "@johnmorrisdotca/address-plus/gb";
console.log(["EC1A 1BB", "sw1a1aa", "GIR 0AA", "Q1 1AA", "M5V 1A1"].map(isValidUKPostcode));
// → [true,true,true,false,false][ true, true, true, false, false ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。