
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@cprecioso/country-flag-emoji
Advanced tools
Easy as pie:
import { getEmojiFlag } from "@cprecioso/country-flag-emoji"
getEmojiFlag("ES") // -> 🇪🇸
getEmojiFlag("nl") // -> 🇳🇱 (doesn't matter, upper or lower case)
// (we only keep the first two letters, so if you're using language codes like "en-US", you should take the last two letters yourself)
getEmojiFlag("pt-BR") // -> 🇵🇹 (oops!)
getEmojiFlag("pt-BR".slice(-2)) // -> 🇧🇷 (correct!)
getEmojiFlag(/* any two-letter country code (ISO 3166-1) */) // -> its corresponding flag emoji
And conversely:
import { getCountryCode } from "@cprecioso/country-flag-emoji"
getCountryCode("🇪🇸") // -> ES
getCountryCode("🇳🇱") // -> NL
getCountryCode("🇵🇹") // -> PT
getCountryCode("🇧🇷") // -> BR
getCountryCode(/* any flag emoji */) // -> its corresponding country code
This package uses CharCode math ✨magic✨, and not a database, so it's extremely lightweight and never goes out-of-date. However, emoji flag <-> ISO country code
is the only feature it offers. If you need more, this is not your package.
Keep in mind that the manufacturer of your OS might choose not to display flags, displaying the country code in emoji letters instead. This is out of my control -- and basically, out of the control of anyone who is not the manufacter of your OS.
FAQs
Lightweight emoji flag to and from country code
The npm package @cprecioso/country-flag-emoji receives a total of 1,737 weekly downloads. As such, @cprecioso/country-flag-emoji popularity was classified as popular.
We found that @cprecioso/country-flag-emoji demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.