@types/country-list
TypeScript icon, indicating that this package has built-in type declarations

2.1.4 • Public • Published

Installation

npm install --save @types/country-list

Summary

This package contains type definitions for country-list (https://github.com/fannarsh/country-list).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/country-list.

index.d.ts

export interface Country {
    code: string;
    name: string;
}

/**
 * Expects an array of code and country name pairs to add to the list. Doesn't return anything.
 */
export function overwrite(countries: Country[]): void;

/**
 * Expects a two-digit country code. Returns the name for that country. If not found, it returns undefined.
 */
export function getName(code: string): string | undefined;

/**
 * Expects the English country name. Returns the code for that country. If not found, it returns undefined.
 */
export function getCode(name: string): string | undefined;

/**
 * Returns an array of all country names.
 */
export function getNames(): string[];

/**
 * Returns an array of all country codes.
 */
export function getCodes(): string[];

/**
 * Returns a key-value object of all countries using the name as key.
 */
export function getNameList(): { [name: string]: string };

/**
 * Returns a key-value object of all countries using the code as key.
 */
export function getCodeList(): { [code: string]: string };

/**
 * Returns an array of all country information, in the same format as it gets imported.
 */
export function getData(): Country[];

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Kyle Roach, and Adam Binford.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/country-list

Weekly Downloads

70,461

Version

2.1.4

License

MIT

Unpacked Size

5.09 kB

Total Files

5

Last publish

Collaborators

  • types