Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

countryflag

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

countryflag - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

27

index.js

@@ -8,8 +8,22 @@ import countries from './countries'

// Well if Bhutan is supported I think we're good to go
const supportsEmojiFlags = ifEmoji('🇧🇹')
// const supportsEmojiFlags = ifEmoji('🇧🇹')
const supportsEmojiFlags = true
const countryflag = _iso2 => {
const iso2 = _iso2.toLowerCase();
const ISO2 = _iso2.toUpperCase();
const country = countries.find(c => c.ISO2 === ISO2)
const countryflag = iso => {
let iso2
let ISO2
let country
if (iso.length === 2) {
iso2 = iso.toLowerCase()
ISO2 = iso2.toUpperCase()
country = countries.find(c => c.ISO2 === ISO2)
}
else if (iso.length === 3) {
const ISO3 = iso.toUpperCase()
country = countries.find(c => c.ISO3 === ISO3)
ISO2 = country.ISO2
iso2 = ISO2.toLowerCase()
} else {
throw new Error(iso, ' is not an ISO 2 nor ISO 3 code')
}

@@ -28,3 +42,2 @@ let emoji = null

const svg = BASE_SVG_PATH_TEMPLATE.replace('{iso2}', iso2);
return {

@@ -37,2 +50,2 @@ emoji,

export default countryflag
export default countryflag
{
"name": "countryflag",
"description": "return an emoji flag or possible fallbacks for a given iso2 code",
"version": "1.0.3",
"version": "2.0.0",
"main": "index.js",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -1,1 +0,1 @@

Returns an emoji flag or possible fallbacks for a given iso2 code
Returns an emoji flag or possible fallbacks for a given iso2 or iso3 code

@@ -9,2 +9,3 @@ #!/usr/bin/env node

ISO2: country.cca2,
ISO3: country.cca3,
name: country.name.common

@@ -11,0 +12,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc