Skip to content

Commit 1713e5c

Browse files
- allow step to be 0 for ValuesIterator
1 parent 4882696 commit 1713e5c

File tree

8 files changed

+16
-24
lines changed

8 files changed

+16
-24
lines changed

dataframe.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ func (df *DataFrame) ValuesIterator(opts ...ValuesOptions) func(opts ...SeriesRe
166166
if row < 0 {
167167
row = df.n + row
168168
}
169-
step = opts[0].Step
170-
if step == 0 {
171-
panic("Step can not be zero")
169+
if opts[0].Step != 0 {
170+
step = opts[0].Step
172171
}
173172
}
174173

series_float64.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,8 @@ func (s *SeriesFloat64) ValuesIterator(opts ...ValuesOptions) func() (*int, inte
309309
if row < 0 {
310310
row = len(s.Values) + row
311311
}
312-
step = opts[0].Step
313-
if step == 0 {
314-
panic("Step can not be zero")
312+
if opts[0].Step != 0 {
313+
step = opts[0].Step
315314
}
316315
}
317316

series_generic.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ func (s *SeriesGeneric) ValuesIterator(opts ...ValuesOptions) func() (*int, inte
285285
if row < 0 {
286286
row = len(s.values) + row
287287
}
288-
step = opts[0].Step
289-
if step == 0 {
290-
panic("Step can not be zero")
288+
if opts[0].Step != 0 {
289+
step = opts[0].Step
291290
}
292291
}
293292

series_int64.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,8 @@ func (s *SeriesInt64) ValuesIterator(opts ...ValuesOptions) func() (*int, interf
303303
if row < 0 {
304304
row = len(s.values) + row
305305
}
306-
step = opts[0].Step
307-
if step == 0 {
308-
panic("Step can not be zero")
306+
if opts[0].Step != 0 {
307+
step = opts[0].Step
309308
}
310309
}
311310

series_mixed.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,8 @@ func (s *SeriesMixed) ValuesIterator(opts ...ValuesOptions) func() (*int, interf
305305
if row < 0 {
306306
row = len(s.values) + row
307307
}
308-
step = opts[0].Step
309-
if step == 0 {
310-
panic("Step can not be zero")
308+
if opts[0].Step != 0 {
309+
step = opts[0].Step
311310
}
312311
}
313312

series_string.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,8 @@ func (s *SeriesString) ValuesIterator(opts ...ValuesOptions) func() (*int, inter
302302
if row < 0 {
303303
row = len(s.values) + row
304304
}
305-
step = opts[0].Step
306-
if step == 0 {
307-
panic("Step can not be zero")
305+
if opts[0].Step != 0 {
306+
step = opts[0].Step
308307
}
309308
}
310309

series_time.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,8 @@ func (s *SeriesTime) ValuesIterator(opts ...ValuesOptions) func() (*int, interfa
314314
if row < 0 {
315315
row = len(s.Values) + row
316316
}
317-
step = opts[0].Step
318-
if step == 0 {
319-
panic("Step can not be zero")
317+
if opts[0].Step != 0 {
318+
step = opts[0].Step
320319
}
321320
}
322321

xseries/series_complex128.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,8 @@ func (s *SeriesComplex128) ValuesIterator(opts ...dataframe.ValuesOptions) func(
317317
if row < 0 {
318318
row = len(s.Values) + row
319319
}
320-
step = opts[0].Step
321-
if step == 0 {
322-
panic("Step can not be zero")
320+
if opts[0].Step != 0 {
321+
step = opts[0].Step
323322
}
324323
}
325324

0 commit comments

Comments
 (0)