Skip to content
/ kokki Public

Convert a country name / code & IP address to an emoji flag

License

Notifications You must be signed in to change notification settings

ninoseki/kokki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kokki

Gem Version Build Status Coverage Status CodeFactor

A Ruby gem for converting a country name / code & IP address to an emoji flag.

Install

gem install kokki
# or
docker pull ninoseki/kokki

Usage

As a CLI

$ kokki TW
🇹🇼
$ kokki USA
🇺🇸
$ kokki japan
🇯🇵
$ kokki 202.214.194.147
🇯🇵
# it suports a defanged ip as an input
$ kokki 1.1.1[.]1
🇦🇺
$ kokki "1.1.1(.)1"
🇦🇺

# or
$ docker run --rm ninoseki/kokki Japan
🇯🇵

As a library

require "kokki"

puts "JP: #{Kokki.flagize('JP')}"
# => JP: 🇯🇵
puts "JPN: #{Kokki.flagize('JPN')}"
# => JPN: 🇯🇵
puts "Japan: #{Kokki.flagize('Japan')}"
# => Japan: 🇯🇵
puts "202.214.194.147: #{Kokki.flagize('202.214.194.147')}"
# => 202.214.194.147: 🇯🇵

begin
  Kokki.flagize("test")
rescue Kokki::InvalidInputError => e
  puts e.message
  # => invalid input: test
end

About

Convert a country name / code & IP address to an emoji flag

Resources

License

Stars

Watchers

Forks

Packages

No packages published