emoji-flags-to-country
Version:
Convert emoji country flags to country code.
34 lines (24 loc) • 1.55 kB
Markdown
# Emoji country flags to country code
[](https://github.com/DavideViolante/emoji-flags-to-country/actions?query=workflow%3A"Node.js+CI") [](https://coveralls.io/github/DavideViolante/emoji-flags-to-country?branch=master) [](https://codeclimate.com/github/DavideViolante/emoji-flags-to-country/maintainability)  [](https://www.paypal.me/dviolante)
[](https://nodei.co/npm/emoji-flags-to-country/)
Convert emoji country flags to country code ISO 3166.
### Install
`npm i emoji-flags-to-country`
### Example
```js
const { flagToCountry, getFlagsInText } = require('emoji-flags-to-country');
const result1 = flagToCountry('🇮🇹');
const result2 = flagToCountry('🇺🇸');
const result3 = flagToCountry('🇪🇸');
console.log(result1); // IT
console.log(result2); // US
console.log(result3); // ES
const result4 = getFlagsInText('This text has 🇺🇸 emoji flags 🇮🇹');
console.log(result4); // ['🇺🇸', '🇮🇹'];
```
### Run tests
`npm test`
### Run lint
`npm run lint`
### Author
- [Davide Violante](https://github.com/DavideViolante/)