New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

super-image

Package Overview
Dependencies
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

super-image - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

coverage/Chrome 61.0.3163 (Mac OS X 10.12.6)/lcov.info

32

lib/index.js

@@ -68,2 +68,27 @@ 'use strict';

// Render picture element if `sources` property exists
if (this.props.sources.length > 0) {
var styleAttrForPict = {};
if (this.props.flexible) {
styleAttrForPict.width = '100%';
styleAttrForPict.height = '100%';
}
return React.createElement(
'picture',
{ style: styleAttrForPict },
this.props.sources.map(function (source, i) {
/* eslint-disable react/no-array-index-key */
return React.createElement('source', _extends({ key: i }, source));
/* eslint-disable react/no-array-index-key */
}),
React.createElement('img', _extends({
src: this.props.src,
alt: this.props.alt,
style: styleAttr
}, extendsProps))
);
}
return React.createElement('img', _extends({

@@ -124,2 +149,8 @@ src: this.props.src,

src: PropTypes.string.isRequired,
sources: PropTypes.arrayOf(PropTypes.shape({
srcSet: PropTypes.string,
sizes: PropTypes.string,
media: PropTypes.string,
type: PropTypes.string
})),
width: PropTypes.string,

@@ -134,2 +165,3 @@ height: PropTypes.string,

SuperImage.defaultProps = {
sources: [],
width: null,

@@ -136,0 +168,0 @@ height: null,

2

package.json
{
"name": "super-image",
"version": "1.0.0",
"version": "1.1.0",
"description": "React component that render a image with object-fit and its fallback",

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

@@ -8,3 +8,3 @@ # SuperImage

> React component that render a image with [`object-fit`](https://developer.mozilla.org/docs/Web/CSS/object-fit) and its fallback
> React component that render the HTML `<img>` or `<picture>` with [`object-fit`](https://developer.mozilla.org/docs/Web/CSS/object-fit) and its fallback

@@ -30,2 +30,12 @@ ## Install

// Use picture element
<SuperImage
src="image.png"
sources={[{ srcSet : 'image@2X.png 2x' }]}
width="160"
height="90"
alt="super-image"
fit="contain"
/>
// Not supported object fit

@@ -47,2 +57,3 @@ <SuperImage

| src | String | Image url | - | Yes |
| sources | Array | Array of objects with source element properties. "srcSet", "sizes", "media" and "type" supported | [] | No |
| width | [`DOMString`](https://heycam.github.io/webidl/#idl-DOMString) | Image width | - | No |

@@ -49,0 +60,0 @@ | height | [`DOMString`](https://heycam.github.io/webidl/#idl-DOMString) | Image height | - | No |

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