File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,6 @@ class DiscreteRange
14
14
upperBound ,
15
15
) ;
16
16
17
- if (
18
- stepSize < 0
19
- ) return Attempt . abandon ( 'Step size must be positive' ) ;
20
-
21
- const overstep = this . width % stepSize ;
22
-
23
- if (
24
- overstep !== 0
25
- ) return Attempt . abandon ( 'Step size must fit evenly into the range' ) ;
26
-
27
17
this . stepSize = stepSize ;
28
18
}
29
19
@@ -43,6 +33,16 @@ class DiscreteRange
43
33
to : givenUpperBound ,
44
34
} ) ;
45
35
36
+ if (
37
+ givenStepSize < 0
38
+ ) return Attempt . abandon ( 'Step size must be positive' ) ;
39
+
40
+ const overstep = validRange . width % givenStepSize ;
41
+
42
+ if (
43
+ overstep !== 0
44
+ ) return Attempt . abandon ( 'Step size must fit evenly into the range' ) ;
45
+
46
46
const validDiscreteRange = new this (
47
47
validRange . lowerBound ,
48
48
validRange . upperBound ,
You can’t perform that action at this time.
0 commit comments