@vitkuz/country-mapper
v1.0.1
Published
A utility for mapping country names between different languages and formats
Readme
Country Mapper
A utility for mapping country names between different languages and formats. Supports both ESM and CommonJS modules.
Installation
npm install vitkuz-country-mapperUsage
ESM (import)
import { getCountryEnglish } from 'vitkuz-country-mapper';
// Get English name for a Russian country name
console.log(getCountryEnglish('Россия')); // "Russia"
// Get English name for an English country name
console.log(getCountryEnglish('United Kingdom')); // "United Kingdom"
// Case-insensitive search
console.log(getCountryEnglish('russia', { caseInsensitive: true })); // "Russia"
// Unofficial names support
console.log(getCountryEnglish('USA')); // "United States of America"CommonJS (require)
const { getCountryEnglish } = require('vitkuz-country-mapper');
// Same usage as ESM
console.log(getCountryEnglish('Россия')); // "Russia"Features
- Maps country names from Russian to English
- Supports English country names
- Handles unofficial names (USA, UK, etc.)
- Case-insensitive search option
- TypeScript support
- Dual ESM/CommonJS support
License
ISC
