Subdivisiontype
A subdivision of a country (a state, a province, a prefecture), with its ISO 3166-2 code, as the lookups hand it out (frozen).
Import it
import type { Subdivision } from "@johnmorrisdotca/kuni/subdivisions";
Also exported from: @johnmorrisdotca/kuni/load, @johnmorrisdotca/kuni
Definition
interface Subdivision {
code: string;
country: string;
shortCode: string;
type: SubdivisionType | null;
level: 1 | 2 | 3;
parent?: string;
name: {
en: string;
ja: string | null;
};
reading?: string;
}
Members
| Name | Type | Description |
|---|---|---|
code | string | ISO 3166-2, always in full: "JP-13", "CA-ON", "US-NY" |
country | string | ISO 3166-1 alpha-2 of the country it is in: "JP" |
shortCode | string | The part after the hyphen: "13", "ON", "NY" |
type | "atoll" | "autonomous-community" | "autonomous-region" | "borough" | "canton" | "capital-district" | "circuit" | "city" | "council-area" | "country" | "county" | "department" | "district" | "division" | "emirate" | "governorate" | "island" | "krai" | "metropolis" | "municipality" | "oblast" | "parish" | "prefecture" | "principal-area" | "province" | "quarter" | "region" | "republic" | "special-administrative-region" | "state" | "territory" | "unitary-authority" | "urban-prefecture" | "voivodeship" | "zone" | null | What kind of place it is; null when no source says |
level | 2 | 1 | 3 | 1 for a country's first division; 2 and 3 for those inside one (France's departments) |
parent (optional) | string | undefined | The code of the subdivision it is inside, for levels 2 and 3: "FR-ARA" for "FR-01" |
name | { en: string; ja: string | null; } | ja is null where no source has a Japanese name, never a guess |
reading (optional) | string | undefined | The name in hiragana, for Japan's prefectures: "とうきょうと" |
Examples
import type { Subdivision } from "@johnmorrisdotca/kuni/subdivisions";
import { subdivision } from "@johnmorrisdotca/kuni/subdivisions";
const value: Subdivision = subdivision("JP-13")!;
console.log(typeof value === "object" ? Object.keys(value).slice(0,6) : value);[ 'code', 'country', 'shortCode', 'type', 'level', 'name' ]What it prints (run when this page was built)