Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fa7ad/emoji-country-code
Transform ISO country codes to Emoji flags
https://github.com/fa7ad/emoji-country-code
code country emoji flag iso-3166-1 pure-javascript
Last synced: 3 months ago
JSON representation
Transform ISO country codes to Emoji flags
- Host: GitHub
- URL: https://github.com/fa7ad/emoji-country-code
- Owner: fa7ad
- License: mit
- Created: 2019-10-19T17:48:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-25T12:10:22.000Z (4 months ago)
- Last Synced: 2024-10-24T22:03:19.157Z (3 months ago)
- Topics: code, country, emoji, flag, iso-3166-1, pure-javascript
- Language: JavaScript
- Homepage: https://npm.im/emoji-country-code
- Size: 1.54 MB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# emoji-country-code
Transform ISO 3166-1 country codes to Emoji flags## Installation
Installation is the same as any other npm module.
```bash
yarn add emoji-country-code
```or
```bash
npm install --save emoji-country-code
```## Usage
In an ES6+ environment you can either import the named export
```js
import { fromCountryCode } from 'emoji-country-code'
```or use the default export
```js
import flagEmoji from 'emoji-country-code'
```CommonJS and UMD builds are available as well.
## API
To transform a country code like `BD` to `🇧🇩`, just call the `fromCountryCode` function
```js
const flag = flagEmoji.fromCountryCode('BD') //=> 🇧🇩
```That's about it! Use it however you like 🚀
---
This project follows
[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)