Skip to content

Commit 9cea14f

Browse files
committed
cleaned up utils
1 parent e87bbdf commit 9cea14f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

utils/utils.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@ package utils
77

88
import (
99
"encoding/json"
10-
"errors"
1110
"regexp"
1211
"strings"
1312
)
1413

15-
func StringToArray(sliceStr string) ([]string, error) {
14+
func StringToArray(sliceStr string) []string {
1615
if sliceStr == "" {
17-
return []string{}, errors.New("sliceStr is empty")
16+
return nil
1817
}
1918

2019
re, err := regexp.Compile(`\s+`)
2120

2221
if err != nil {
23-
return []string{}, err
22+
return nil
2423
}
2524

2625
normalized := re.ReplaceAllString(sliceStr, "")
2726

2827
tokens := strings.Split(normalized, ",")
2928

30-
return tokens, nil
29+
return tokens
3130
}
3231

3332
func GetJsonSafe[T any](jsonStr string) (T, error) {

0 commit comments

Comments
 (0)