Reference · Regions and international bodies
groupingsOffunction
The groupings a country, or a subdivision, is a member of: now, or on a given day.
Import it
import { groupingsOf } from "@johnmorrisdotca/kuni/groupings";
Definition
function groupingsOf(code: string, options?: GroupingDateOptions): readonly Grouping[]
Parameters
| Name | Type | Description |
|---|---|---|
code | string | An alpha-2 code ("FR", either case) or an ISO 3166-2 code ("JP-13"). |
options (optional) | GroupingDateOptions |
|
Returns
readonly Grouping[]
The groupings, frozen, in the order of groupings(); an empty list for a code in none, or not a code.
Examples
import { groupingsOf } from "@johnmorrisdotca/kuni/groupings";
console.log(groupingsOf("GB", { kind: "membership" }).map((one) => one.id)); // ["un", "nato", "g7", ...]
console.log(groupingsOf("GB", { kind: "membership", on: "2015-01-01" }).some((one) => one.id === "eu")); // true
console.log(groupingsOf("JP-13").map((one) => one.id)); // ["jp-kanto"][ 'un', 'nato', 'g7', 'g20', 'oecd', 'commonwealth' ]
true
[ 'jp-kanto' ]What it prints (run when this page was built)