ParseOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Options for every parser: the country, strict postal codes, snake_case keys and the rest. Every one is optional.
インポート
import type { ParseOptions } from "@johnmorrisdotca/address-plus/jp";
ほかのエクスポート元: @johnmorrisdotca/address-plus/au, @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
定義
interface ParseOptions {
country?: "CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE" | "GP" | "MQ" | "GF" | "RE" | "YT" | "auto";
countries?: readonly CountryModule[];
normalize?: boolean;
validatePostalCode?: boolean;
language?: "auto" | "en" | "fr";
extractFacilities?: boolean;
parseParenthetical?: boolean;
strict?: boolean;
useSnakeCase?: boolean;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
country (省略可) | "CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE" | "GP" | "MQ" | "GF" | "RE" | "YT" | "auto" | undefined | |
countries (省略可) | readonly CountryModule[] | undefined | |
normalize (省略可) | boolean | undefined | |
validatePostalCode (省略可) | boolean | undefined | |
language (省略可) | "auto" | "en" | "fr" | undefined | |
extractFacilities (省略可) | boolean | undefined | |
parseParenthetical (省略可) | boolean | undefined | |
strict (省略可) | boolean | undefined | |
useSnakeCase (省略可) | boolean | undefined |
例
import { parseLocation } from "@johnmorrisdotca/address-plus";
import type { ParseOptions } from "@johnmorrisdotca/address-plus/jp";
console.log(Reflect.get(parseLocation("東京都千代田区丸の内1-2-3", { country: "JP", useSnakeCase: true }) ?? {}, "prefecture_code"));
// → "13"13出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。