ts-country-code
v1.0.2
Published
List of ISO-2 and 3 country codes
Downloads
16
Readme
🌟 ts-country-code
A lightweight and simple Node.js package written in TypeScript that provides enums for ISO 2-alpha and 3-alpha country codes, making it easy to work with standardized country representations in your JavaScript or TypeScript projects.
Key Features:
- ISO Standards: Includes all ISO 3166-1 alpha-2 and alpha-3 country codes.
- Typed Safety: Enums ensure you work with valid and predictable values.
- Lightweight and Fast: Minimal dependencies and optimized for performance.
- TypeScript Support: Designed for seamless integration into TypeScript projects.
🚀 Installation
npm install ts-country-code
🛠 Getting Started
Import the enums and start using them in your project:
import codes from 'ts-country-code';
console.log(codes.ISO2.US); // Output: 'US'
console.log(codes.ISO3.USA); // Output: 'USA'
🌟 Why Choose ts-country-code?
- Eliminates the hassle of manually defining country codes.
- Fully typed enums provide clarity and reduce bugs.
- Supports both modern JavaScript and TypeScript environments.
🌍 Supported Environments
- Node.js 14+
- TypeScript 4+
- ECMAScript Modules (ESM) and CommonJS
🎨 Customization
This package is designed for minimal configuration, but you can extend the enums or integrate them with other tools in your stack.
🔧 Acknowledgments & Contributions
This package was inspired by the need for robust and lightweight ISO country code handling. Contributions and feedback are welcome! Feel free to open an issue or submit a pull request.