refactor: simplify code

This commit is contained in:
Benjy Cui
2016-04-27 17:48:17 +08:00
parent 37b7f508da
commit e4396ae4bd
2 changed files with 2 additions and 8 deletions
+1 -7
View File
@@ -46,13 +46,7 @@ class Slider extends React.Component {
let recent;
if (props.range && upperBound === lowerBound) {
if (lowerBound === max) {
recent = 'lowerBound';
} else if (upperBound === min) {
recent = 'upperBound';
} else {
recent = 'upperBound';
}
recent = lowerBound === max ? 'lowerBound' : 'upperBound';
} else {
recent = 'upperBound';
}
+1 -1
View File
@@ -3,7 +3,7 @@ import classNames from 'classnames';
import warning from 'warning';
function calcPoints(vertical, marks, dots, step, min, max) {
warning(dots ? step : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
warning(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
const points = Object.keys(marks).map(parseFloat);
if (dots) {
for (let i = min; i <= max; i = i + step) {