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

react-image-fallback

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-image-fallback - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

25

lib/index.js

@@ -37,3 +37,3 @@ "use strict";

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ReactImageFallback).call(this, props));
var _this = _possibleConstructorReturn(this, (ReactImageFallback.__proto__ || Object.getPrototypeOf(ReactImageFallback)).call(this, props));

@@ -74,7 +74,8 @@ _this.state = {

var image = _ref.image;
var fallbacks = _ref.fallbacks;
var image = _ref.image,
fallbacks = _ref.fallbacks;
var fallbacksArray = Array.isArray(fallbacks) ? fallbacks : [fallbacks];
var imagesArray = image ? [image].concat(fallbacksArray) : fallbacksArray;
var imagesArray = [image].concat(fallbacks).filter(function (fallback) {
return !!fallback;
});
this.displayImage.onerror = function () {

@@ -87,3 +88,3 @@ if (imagesArray.length > 2 && typeof imagesArray[1] === "string") {

_this2.setState({
imageSource: imagesArray[1]
imageSource: imagesArray[1] || null
}, function () {

@@ -104,3 +105,13 @@ if (_this2.props.onError) {

};
this.displayImage.src = imagesArray[0];
if (typeof imagesArray[0] === "string") {
this.displayImage.src = imagesArray[0];
} else {
this.setState({
imageSource: imagesArray[0]
}, function () {
if (_this2.props.onLoad) {
_this2.props.onLoad(imagesArray[0]);
}
});
}
}

@@ -107,0 +118,0 @@ }, {

{
"name": "react-image-fallback",
"version": "7.0.0",
"version": "7.0.1",
"description": "if your image doesn't exist, fallback onto another provided image.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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