setValidatedPostalCode関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Sets a ZIP or postal code on a result, the way the parsers do: split into ZIP and ZIP+4, a Canadian code in capitals
with one space, with zipValid set, and in strict mode only when the code is well formed. It changes the object it
is given.
インポート
import { setValidatedPostalCode } from "@johnmorrisdotca/address-plus";
定義
function setValidatedPostalCode(result: ParsedAddress | ParsedIntersection, zipCode: string, options: ParseOptions): void
引数
| 名前 | 型 | 説明 |
|---|---|---|
result | ParsedAddress | ParsedIntersection | The parsed address or intersection to set the code on. |
zipCode | string | The code as written. |
options | ParseOptions |
|
例
import { setValidatedPostalCode } from "@johnmorrisdotca/address-plus";
const parsed = { city: "Toronto", state: "ON" };
setValidatedPostalCode(parsed, "m5h2n2", {});
console.log(parsed);
// → {"city":"Toronto","state":"ON","zip":"M5H 2N2"}{ city: 'Toronto', state: 'ON', zip: 'M5H 2N2' }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。