Socket
Socket
Sign inDemoInstall

react-countries-flags

Package Overview
Dependencies
213
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.3 to 1.3.4

index.d.ts

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
});
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 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;
var flag;

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

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

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

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

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

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

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

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

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

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

import React from 'react';
export default function ReactCountriesFlags({isoCode, alt = "flag", width = 25, height = 15}) {
let flag;
let iso = isoCode?.toString().toLowerCase();
"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();
try {
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`);
flag = require("../flags/".concat(iso, ".png"));
}
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>
);
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",
} })));
};
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc