Installations
npm install country-code-emoji
Score
99.1
Supply Chain
83.5
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Developer
thekelvinliu
Developer Guide
Module System
CommonJS, ESM
Min. Node Version
Typescript Support
Yes
Node Version
12.18.3
NPM Version
6.14.9
Statistics
133 Stars
39 Commits
10 Forks
3 Watching
3 Branches
1 Contributors
Updated on 11 Nov 2024
Bundle Size
780.00 B
Minified
418.00 B
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
5,005,522
Last day
-41.3%
8,740
Compared to previous day
Last week
-13.9%
48,747
Compared to previous week
Last month
22.3%
197,974
Compared to previous month
Last year
22.4%
1,671,497
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
country-code-emoji
convert country codes (ISO 3166-1 alpha-2) to corresponding emoji flags (unicode regional indicator symbols)
about
this is a completely dependency-free module to convert ascii letters to regional indicator symbols;
for valid country codes, this results in that country's emoji flag.
commonjs and es module builds are available via package.json
's main and module.
it relies on String.fromCodePoint
internally, but does not provide any polyfills.
if your environment does not support String.fromCodePoint
,
grab a polyfill like this one from mdn.
install
1# npm 2npm install country-code-emoji 3 4# yarn 5yarn add country-code-emoji
usage
1// commonjs module 2const { countryCodeEmoji, emojiCountryCode } = require('country-code-emoji'); 3countryCodeEmoji('US'); // returns '🇺🇸' 4emojiCountryCode('🇺🇸'); // returns 'US' 5 6// es module 7import { countryCodeEmoji, emojiCountryCode } from 'country-code-emoji'; 8['AE', 'CN', 'GB'].map(countryCodeEmoji); // returns ['🇦🇪', '🇨🇳', '🇬🇧'] 9['🇦🇪', '🇨🇳', '🇬🇧'].map(emojiCountryCode); // returns ['AE', 'CN', 'GB']
this module exports a pair of functions to convert country codes to/from flag emojis.
the first is countryCodeEmoji(cc)
.
it accepts a two-character (case-insensitive) country code and throws a TypeError
if anything else is passed.
more specifically, cc
is expected to be a ISO 3166-1 alpha-2 country code.
to keep things simple, if cc
a two letter string, but not an actual ISO 3166-1 alpha-2 code,
the regional indicator symbols corresponding to the letters in cc
are returned.
the second is emojiCountryCode(flag)
,
which accepts a flag emoji and similarly throws a TypeError
if anything else is passed.
1// default export is countryCodeEmoji 2import flag from 'country-code-emoji'; 3 4flag(); // throws TypeError 5['Us', 'uS', 'us'].every(e => flag(e) === flag('US')); // returns true 6flag('UK'); // returns '🇺🇰'
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Reason
22 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to country-code-emoji
country-flag-emoji-polyfill
Add country flag emojis to Chromium-based browsers on Windows
country-emoji
Converts between country names, ISO 3166-1 codes and flag emojis.
react-country-flag
> React component for emoji/svg country flags.
country-flag-icons
Vector (*.svg) country flag icons in 3x2 aspect ratio.