diff --git a/functions/sequence_using.go b/functions/sequence_using.go index 8c3f39d..4a82406 100644 --- a/functions/sequence_using.go +++ b/functions/sequence_using.go @@ -18,13 +18,13 @@ import "github.com/elliotchance/pie/pie/util" // others params will be ignored func (ss SliceType) SequenceUsing(creator func(int) ElementType, params ...int) SliceType { var seq = func(min, max, step int) (seq SliceType) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(SliceType, lenght) - for i := 0; i < lenght; min += step { + seq = make(SliceType, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/pie/carpointers_pie.go b/pie/carpointers_pie.go index 526a232..6d314ca 100755 --- a/pie/carpointers_pie.go +++ b/pie/carpointers_pie.go @@ -547,13 +547,13 @@ func (ss carPointers) Send(ctx context.Context, ch chan<- *car) carPointers { // others params will be ignored func (ss carPointers) SequenceUsing(creator func(int) *car, params ...int) carPointers { var seq = func(min, max, step int) (seq carPointers) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(carPointers, lenght) - for i := 0; i < lenght; min += step { + seq = make(carPointers, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/pie/cars_pie.go b/pie/cars_pie.go index 41473be..a95353c 100755 --- a/pie/cars_pie.go +++ b/pie/cars_pie.go @@ -547,13 +547,13 @@ func (ss cars) Send(ctx context.Context, ch chan<- car) cars { // others params will be ignored func (ss cars) SequenceUsing(creator func(int) car, params ...int) cars { var seq = func(min, max, step int) (seq cars) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(cars, lenght) - for i := 0; i < lenght; min += step { + seq = make(cars, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/pie/float64s_pie.go b/pie/float64s_pie.go index 318cd02..25a4617 100755 --- a/pie/float64s_pie.go +++ b/pie/float64s_pie.go @@ -779,13 +779,13 @@ func (ss Float64s) Sequence(params ...int) Float64s { // others params will be ignored func (ss Float64s) SequenceUsing(creator func(int) float64, params ...int) Float64s { var seq = func(min, max, step int) (seq Float64s) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(Float64s, lenght) - for i := 0; i < lenght; min += step { + seq = make(Float64s, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/pie/ints_pie.go b/pie/ints_pie.go index 02678c6..50ca385 100755 --- a/pie/ints_pie.go +++ b/pie/ints_pie.go @@ -779,13 +779,13 @@ func (ss Ints) Sequence(params ...int) Ints { // others params will be ignored func (ss Ints) SequenceUsing(creator func(int) int, params ...int) Ints { var seq = func(min, max, step int) (seq Ints) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(Ints, lenght) - for i := 0; i < lenght; min += step { + seq = make(Ints, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/pie/strings_pie.go b/pie/strings_pie.go index b905810..7444ee5 100755 --- a/pie/strings_pie.go +++ b/pie/strings_pie.go @@ -654,13 +654,13 @@ func (ss Strings) Send(ctx context.Context, ch chan<- string) Strings { // others params will be ignored func (ss Strings) SequenceUsing(creator func(int) string, params ...int) Strings { var seq = func(min, max, step int) (seq Strings) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(Strings, lenght) - for i := 0; i < lenght; min += step { + seq = make(Strings, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/template.go b/template.go index e3c4cdd..ba7f396 100644 --- a/template.go +++ b/template.go @@ -925,13 +925,13 @@ import "github.com/elliotchance/pie/pie/util" // others params will be ignored func (ss SliceType) SequenceUsing(creator func(int) ElementType, params ...int) SliceType { var seq = func(min, max, step int) (seq SliceType) { - lenght := int(util.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(util.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make(SliceType, lenght) - for i := 0; i < lenght; min += step { + seq = make(SliceType, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ } diff --git a/v2/sequence_using.go b/v2/sequence_using.go index 1a5e930..b6860b0 100644 --- a/v2/sequence_using.go +++ b/v2/sequence_using.go @@ -18,13 +18,13 @@ import "math" // others params will be ignored func SequenceUsing[T any](ss []T, creator func(int) T, params ...int) []T { var seq = func(min, max, step int) (seq []T) { - lenght := int(math.Round(float64(max-min) / float64(step))) - if lenght < 1 { + length := int(math.Round(float64(max-min) / float64(step))) + if length < 1 { return } - seq = make([]T, lenght) - for i := 0; i < lenght; min += step { + seq = make([]T, length) + for i := 0; i < length; min += step { seq[i] = creator(min) i++ }