Skip to the content

Kuni国

Look up countries, codes, names and subdivisions, load country data on demand and mount a native country card.

Kuni (国) is Japanese for a country. About the name

Contents

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

NameTypeDescription
codestring

An alpha-2 code ("FR", either case) or an ISO 3166-2 code ("JP-13").

options (optional)GroupingDateOptions

on for a day in the past, kind to keep one kind.

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kuni 1.4.0.