1.4.1 • Published 2 years ago

@brixtol/country-names v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@brixtol/country-names

Country code (3166-1 alpha-2) to Country name (ISO 3166 mappings used by the Brixtol Textiles internal API when dealing with Localization and i18n operations.

Mappings returned in the English Language.

Minified: 4.15 KB Gzipped: 2.25 KB

Install

pnpm

pnpm add @brixtol/country-names

npm

npm install @brixtol/country-names

Yarn

yarn add @brixtol/country-names

Usage

You can pass in a 2 letter country code that is lowercase, uppercase or a mixture of both.

import { getCountryName } from '@brixtol/country-names';

const sweden = getCountryName('SE'); // Sweden
const netherlands = getCountryName('nl'); // Netherlands
const usa = getCountryName('uS'); // United States of America
EXTRAS

The module also exposes the raw mappings and interface on the export. The mappings object is provided read only using Object.freeze. In addition to the raw mappings a ISO code union export is also exposed.

import { Countries, ICountries, CountryCodes, Country } from '@brixtol/country-names';

// Mapping Object

Countries.SE; // Sweden
Countries.NL; // Netherlands
Countries.RU; // Russian Federation

// Interface

ICountries.SE; // Sweden
ICountries.NL; // Netherlands
ICountries.RU; // Russian Federation

// Country Code Union

CountryCodes<'SE' | 'NL' | 'RU'>; // etc etc

The interface is identical to the mapping

Related

Static GeoIP utility

Country code to currency code mappings:

Currency code to currency symbol mappings:

License

Licensed under MIT


We open source!

1.4.1

2 years ago

1.4.0

2 years ago

1.2.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.0

3 years ago