Skip to content

Commit f1d679f

Browse files
author
Amir Tocker
committed
Remove unneeded variables.
No need to explicitily filter the `children` property since we only pass valid options.
1 parent f9ef299 commit f1d679f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/components/CloudinaryContext/CloudinaryContext.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ export default class CloudinaryContext extends CloudinaryComponent {
1717
}
1818

1919
getChildContext() {
20-
let {children, ...otherProps} = this.props;
2120
let context = {};
2221
// only pass valid Cloudinary options
2322
CloudinaryComponent.VALID_OPTIONS.forEach(key => {
24-
let val = otherProps[key] || this.context[key];
25-
if(val !== null && val !== undefined){
23+
let val = this.props[key] || this.context[key];
24+
if (val !== undefined && val !== null) {
2625
context[key] = val;
2726
}
2827
});

src/components/Image/Image.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ export default class Image extends CloudinaryComponent {
66
constructor(props, context) {
77
super(props, context);
88
var options = this.getOptions(props, context);
9-
var options2 = options;
10-
let cl = cloudinary.Cloudinary.new(options2);
11-
var url = cl.url(props.publicId, options2);
9+
let cl = cloudinary.Cloudinary.new(options);
10+
var url = cl.url(props.publicId, options);
1211
this.state = {url: url};
1312
}
1413

@@ -45,7 +44,6 @@ export default class Image extends CloudinaryComponent {
4544

4645
render() {
4746
var options = this.getOptions(this.props, this.context);
48-
var {publicId, transformation, ...other} = this.props;
4947
var attributes = cloudinary.Transformation.new(options).toHtmlAttributes();
5048
return (
5149
<img {...attributes} src={this.state.url} />

0 commit comments

Comments
 (0)