Skip to content

Instantly share code, notes, and snippets.

View calmarti's full-sized avatar
🏠
Working from home

Ivan Martínez C. calmarti

🏠
Working from home
View GitHub Profile
@calmarti
calmarti / country2emoji.js
Created August 8, 2021 14:58 — forked from theory-of-soul/country2emoji.js
Javascript : convert country code to emoji flag by Stan Larroque
// Assume the country_code is a ISO 3166-1 alpha-2 string (eg: "US")
function country2emoji(country_code) {
var OFFSET = 127397;
var cc = country_code.toUpperCase();
function _toConsumableArray(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;