PostalValidationResult型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What validatePostalCode returns: whether the code is well formed, its type, and the code written the standard way.
インポート
import type { PostalValidationResult } from "@johnmorrisdotca/address-plus";
定義
interface PostalValidationResult {
isValid: boolean;
type: "zip" | "postal" | null;
formatted?: string;
message?: string;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
isValid | boolean | |
type | "zip" | "postal" | null | |
formatted (省略可) | string | undefined | |
message (省略可) | string | undefined |
例
import { validatePostalCode } from "@johnmorrisdotca/address-plus";
import type { PostalValidationResult } from "@johnmorrisdotca/address-plus";
console.log(validatePostalCode("98101"));
// → {"isValid":true,"type":"zip","formatted":"98101","message":"Valid US ZIP code format"}{
isValid: true,
type: 'zip',
formatted: '98101',
message: 'Valid US ZIP code format'
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。