Created
February 24, 2021 14:12
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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