Skip to content

Commit 4329d88

Browse files
committed
join buildSrcSet() and buildSizes() result with comma
1 parent 3acb06d commit 4329d88

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Image.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,28 @@ export default class Image extends React.Component<Props, State> {
4141
constructor(props) {
4242
super(props);
4343
this.state = {
44-
widthDescriptorOnly: Object.keys(this.props.srcSet).every((descriptor) => {
45-
return matchWidthDescriptor(descriptor);
46-
}),
44+
widthDescriptorOnly: Object.keys(this.props.srcSet).every((descriptor) => matchWidthDescriptor(descriptor)),
4745
};
4846
}
4947

50-
// TODO: fix any
51-
buildSrcSet(): any {
48+
buildSrcSet() {
5249
const matcher = this.state.widthDescriptorOnly ? matchWidthDescriptor : matchPixelDescriptor;
5350
return Object.keys(this.props.srcSet)
5451
.filter(matcher)
55-
.map(descriptor => `${this.props.srcSet[descriptor]} ${descriptor}`);
52+
.map(descriptor => `${this.props.srcSet[descriptor]} ${descriptor}`)
53+
.join(',');
5654
}
5755

58-
// TODO: fix any
59-
buildSizes(): any {
56+
buildSizes() {
6057
if (this.props.sizes && this.state.widthDescriptorOnly) {
6158
return this.props.sizes.map((size) => {
6259
if (size.mediaCondition) {
6360
return `${size.mediaCondition} ${size.size}`;
6461
}
6562
return `${size.size}`;
66-
});
63+
}).join(',');
6764
}
68-
return null;
65+
return '';
6966
}
7067

7168
render() {

0 commit comments

Comments
 (0)