DavideViolante / emoji-flags-to-country

Convert emoji country flags to country code ISO 3166.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emoji country flags to country code

Coverage Status Maintainability npm Donate

NPM

Convert emoji country flags to country code ISO 3166.

Install

npm i emoji-flags-to-country

Example

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

About

Convert emoji country flags to country code ISO 3166.

License:MIT License


Languages

Language:JavaScript 100.0%