getValidationErrors関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The errors validateAddress finds, without the rest of its result.
インポート
import { getValidationErrors } from "@johnmorrisdotca/address-plus";
定義
function getValidationErrors(addressString: string, options?: ValidationOptions): ValidationError[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
addressString | string | The address as one string. |
options (省略可) | ValidationOptions | What to require and how strict to be (see |
戻り値
ValidationError[]
The errors, each with its field, code and message; an empty array when there are none.
例
import { getValidationErrors } from "@johnmorrisdotca/address-plus";
console.log(getValidationErrors("123 Main St, Seattle, NY 98101", { strictPostalValidation: true }).map((error) => error.code));
// → ["POSTAL_REGION_MISMATCH"][ 'POSTAL_REGION_MISMATCH' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。