Skip to content

Commit

Permalink
Merge pull request #4 from Henry-Sarabia/iss-3
Browse files Browse the repository at this point in the history
Change variadic parameters to slice parameters
  • Loading branch information
Henry Sarabia committed Feb 16, 2019
2 parents 5d8fb33 + 868ceee commit 1cbe8a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sliceconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// Atoi converts the provided strings into their respective base 10 integer
// representations. If any of the strings are not valid digits, an error is returned.
func Atoi(str ...string) ([]int, error) {
func Atoi(str []string) ([]int, error) {
var ints []int
for _, s := range str {
i, err := strconv.Atoi(s)
Expand All @@ -23,7 +23,7 @@ func Atoi(str ...string) ([]int, error) {

// Itoa converts the provided integers into their respective string representations
// in base 10.
func Itoa(ints ...int) []string {
func Itoa(ints []int) []string {
var str []string
for _, i := range ints {
str = append(str, strconv.Itoa(i))
Expand Down
4 changes: 2 additions & 2 deletions sliceconv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestAtoi(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ints, err := Atoi(test.strings...)
ints, err := Atoi(test.strings)
if errors.Cause(err) != test.wantErr {
t.Errorf("got: <%v>, want: <%v>", errors.Cause(err), test.wantErr)
}
Expand All @@ -45,7 +45,7 @@ func TestItoa(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
s := Itoa(test.ints...)
s := Itoa(test.ints)

if !reflect.DeepEqual(s, test.wantStrings) {
t.Errorf("got: <%v>, want: <%v>", s, test.wantStrings)
Expand Down

0 comments on commit 1cbe8a6

Please sign in to comment.