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

react-countries-flags

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-countries-flags - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

32

dist/index.js
"use strict";
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var react_1 = __importDefault(require("react"));
var ReactCountriesFlags = function ReactCountriesFlags(_a) {
var isoCode = _a.isoCode,
_b = _a.alt,
alt = _b === void 0 ? 'flag' : _b,
_c = _a.width,
width = _c === void 0 ? 25 : _c,
_d = _a.height,
height = _d === void 0 ? 15 : _d;
exports["default"] = ReactCountriesFlags;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function ReactCountriesFlags(_ref) {
var isoCode = _ref.isoCode,
_ref$alt = _ref.alt,
alt = _ref$alt === void 0 ? "flag" : _ref$alt,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 25 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 15 : _ref$height;
var flag;

@@ -28,3 +25,3 @@ var iso = isoCode === null || isoCode === void 0 ? void 0 : isoCode.toString().toLowerCase();

}
return react_1["default"].createElement("div", {
return /*#__PURE__*/_react["default"].createElement("div", {
className: "reactCountriesFlags",

@@ -40,3 +37,3 @@ style: {

}
}, react_1["default"].createElement("img", {
}, /*#__PURE__*/_react["default"].createElement("img", {
src: flag,

@@ -53,2 +50,3 @@ alt: alt,

}));
};
}
;
{
"name": "react-countries-flags",
"version": "1.3.4",
"version": "1.3.5",
"main": "./dist/index.js",
"scripts": {
"build": "tsc && babel src --out-dir dist"
"build": "npx babel src --out-dir dist"
},

@@ -20,8 +20,3 @@ "author": "Narek Grigoryan <gnname19@gmail.com>",

},
"devDependencies": {
"@types/node": "^20.9.1",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"typescript": "^5.2.2"
},
"devDependencies": {},
"description": "Easy way to display world country flags in various operating systems.",

@@ -28,0 +23,0 @@ "repository": {

@@ -1,35 +0,36 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var ReactCountriesFlags = function (_a) {
var isoCode = _a.isoCode, _b = _a.alt, alt = _b === void 0 ? 'flag' : _b, _c = _a.width, width = _c === void 0 ? 25 : _c, _d = _a.height, height = _d === void 0 ? 15 : _d;
var flag;
var iso = isoCode === null || isoCode === void 0 ? void 0 : isoCode.toString().toLowerCase();
import React from 'react';
export default function ReactCountriesFlags({isoCode, alt = "flag", width = 25, height = 15}) {
let flag;
let iso = isoCode?.toString().toLowerCase();
try {
flag = require("../flags/".concat(iso, ".png"));
flag = require(`../flags/${iso}.png`);
} catch (e) {
iso ? console.warn(`Flag for ${iso} not found. Using default flag instead.`) : console.warn(`Using default flag instead.`)
flag = require(`../flags/default.png`);
}
catch (e) {
iso ? console.warn("Flag for ".concat(iso, " not found. Using default flag instead.")) : console.warn("Using default flag instead.");
flag = require("../flags/default.png");
}
return (react_1.default.createElement("div", { className: "reactCountriesFlags", style: {
width: width + "px",
height: height + "px",
margin: 0,
padding: 0,
display: "flex",
justifyContent: "center",
alignItems: "center",
} },
react_1.default.createElement("img", { src: flag, alt: alt, style: {
width: "100%",
height: "100%",
border: "1px solid #eeeeee",
backgroundPosition: "center",
backgroundSize: "contain",
backgroundRepeat: "no-repeat",
} })));
return (
<div className="reactCountriesFlags"
style={{
width: width + "px",
height: height + "px",
margin: 0,
padding: 0,
display: "flex",
justifyContent: "center",
alignItems: "center",
}}>
<img src={flag}
alt={alt}
style={{
width: "100%",
height: "100%",
border: "1px solid #eeeeee",
backgroundPosition: "center",
backgroundSize: "contain",
backgroundRepeat: "no-repeat",
}}
/>
</div>
);
};
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