Skip to content

Instantly share code, notes, and snippets.

@wlkr
Created February 24, 2021 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlkr/b7ec645fe0935a515b9cfdf51c3ada31 to your computer and use it in GitHub Desktop.
Save wlkr/b7ec645fe0935a515b9cfdf51c3ada31 to your computer and use it in GitHub Desktop.
Convert an ISO 3166 alpha-2 country code to its unicode flag using ClojureScript.
(defn country->flag
"Convert an ISO 3166 Alpha-2 country code to its unicode flag."
[country]
(str/replace
(str/upper-case country)
#"."
#(.fromCodePoint js/String (+ (.charCodeAt %1 0) 127397))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment