Reference · Japanese addresses
ParseOptionstype
Options for every parser: the country, strict postal codes, snake_case keys and the rest. Every one is optional.
Import it
import type { ParseOptions } from "@johnmorrisdotca/address-plus/jp";
Also exported from: @johnmorrisdotca/address-plus/au, @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
Definition
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;
}
Members
| Name | Type | Description |
|---|---|---|
country (optional) | "CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE" | "GP" | "MQ" | "GF" | "RE" | "YT" | "auto" | undefined | |
countries (optional) | readonly CountryModule[] | undefined | |
normalize (optional) | boolean | undefined | |
validatePostalCode (optional) | boolean | undefined | |
language (optional) | "auto" | "en" | "fr" | undefined | |
extractFacilities (optional) | boolean | undefined | |
parseParenthetical (optional) | boolean | undefined | |
strict (optional) | boolean | undefined | |
useSnakeCase (optional) | boolean | undefined |
Examples
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"13What it prints (run when this page was built)