Reference · Countries and lookup tools
dependenciesOffunction
The places that belong to a state: every country code whose sovereign is that state, in alpha-2 order.
Import it
import { dependenciesOf } from "@johnmorrisdotca/kuni";
Definition
function dependenciesOf(code: string): readonly Country[]
Parameters
| Name | Type | Description |
|---|---|---|
code | string | The state's code: alpha-2 ("GB", "gb"), alpha-3 ("GBR") or numeric ("826"). |
Returns
readonly Country[]
The places, frozen; an empty list for a state with none and for anything that is not a country code.
Examples
import { dependenciesOf } from "@johnmorrisdotca/kuni";
console.log(dependenciesOf("DK").map((one) => one.alpha2)); // ["FO", "GL"]
console.log(dependenciesOf("GB").length); // 15
console.log(dependenciesOf("JP").length); // 0[ 'FO', 'GL' ]
15
0What it prints (run when this page was built)