Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

using template literals #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/helpers/renderHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
var divArray = [];
for (var i = 0; i < number; i++) {
divArray.push(
<div className={'test-div-' + i} key={i} style={{ height: height }} />
<div className={`test-div-${i}`} key={i} style={{ height: height }} />
);
}

Expand All @@ -16,7 +16,7 @@ module.exports = {
for (var i = 0; i < heights.length; i++) {
divArray.push(
<div
className={'test-div-' + i}
className={`test-div-${i}`}
key={i}
style={{ height: heights[i] }}
/>
Expand Down
2 changes: 1 addition & 1 deletion pipeline/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function(shouldWatch, envObject, files) {
});

root.on('log', function() {
console.log('[' + moment().format() + '] Browserify bundle refreshed');
console.log(`[${moment().format()}] Browserify bundle refreshed`);
});
}

Expand Down
15 changes: 3 additions & 12 deletions src/utils/checkProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,16 @@ var _isFinite = require('lodash.isfinite');
module.exports = function(props: ReactInfiniteProps) {
var rie = 'Invariant Violation: ';
if (!(props.containerHeight || props.useWindowAsScrollContainer)) {
throw new Error(
rie +
'Either containerHeight or useWindowAsScrollContainer must be provided.'
);
throw new Error(`${rie}Either containerHeight or useWindowAsScrollContainer must be provided.`);
}

if (!(_isFinite(props.elementHeight) || Array.isArray(props.elementHeight))) {
throw new Error(
rie +
'You must provide either a number or an array of numbers as the elementHeight.'
);
throw new Error(`${rie}You must provide either a number or an array of numbers as the elementHeight.`);
}

if (Array.isArray(props.elementHeight)) {
if (React.Children.count(props.children) !== props.elementHeight.length) {
throw new Error(
rie +
'There must be as many values provided in the elementHeight prop as there are children.'
);
throw new Error( `${rie}There must be as many values provided in the elementHeight prop as there are children.`);
}
}
};