@brixtol/country-continent

中文文档
1.0.0发布于 2021/12/01MITTypeScriptESM + CJS近 30 天下载 8990

Mappings for 2 letter (Alpha 2) country codes to Continent code/name

原始使用文档
文档目录5 节
  1. @brixtol/country-continent
  2. Install
  3. Usage
  4. Related
  5. License

@brixtol/country-continent

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

Mappings returned in the English Language.

Minified: 2.39 KB
Gzipped: 897 B

Install

pnpm

pnpm add @brixtol/country-continent

npm

npm install @brixtol/country-continent

Yarn

yarn add @brixtol/country-continent

Usage

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

import { getContinentCode, getContinentName } from '@brixtol/country-continent';

const sweden = getContinentName('SE'); // Europe
const russia = getContinentName('ru'); // Asia
const usa = getContinentName('uS'); // North America
const australia = getContinentCode('AU'); // OC
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 { IContinents, ContinentCodes, ContinentNames } from '@brixtol/country-continent';

// Mapping Object

ContinentCodes.SE; // EU
ContinentNames.SE; // Europe
ContinentCodes.NL; // EU
ContinentNames.NL; // Europe
ContinentCodes.RU; // AS
ContinentNames.RU; // Asia

// Interface

IContinents.SE; // EU
IContinents.NL; // EU
IContinents.RU; // AS

The interface is identical to the mapping

Static GeoIP utility

Country code to currency code mappings:

Currency code to currency symbol mappings:

License

Licensed under MIT


We ♡ open source!

版本与发布记录

@brixtol/country-continent 共发布 1 个版本,首次发布于 2021/12/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0latest2021/12/014 年前

关于 @brixtol/country-continent 的常见问题

@brixtol/country-continent 是什么?

Mappings for 2 letter (Alpha 2) country codes to Continent code/name

如何安装 @brixtol/country-continent?

在项目目录运行 npm install @brixtol/country-continent,或使用 pnpm add / yarn add / bun add。

@brixtol/country-continent 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@brixtol/country-continent 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@brixtol/country-continent 可以商用吗?

@brixtol/country-continent 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@brixtol/country-continent 的下载量有多少?

根据 npm 官方下载统计,@brixtol/country-continent 在 2026/10/09 – 2026/11/07 这 30 天内被下载 8,990 次,日均约 300 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@brixtol/country-continent 还在维护吗?

最新版本 1.0.0 发布于 2021/12/01(4 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/12/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。