Skip to content

Commit d584e34

Browse files
fix: Simplify code
1 parent 20c8459 commit d584e34

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

internal/pkg/utils/url/url.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ func parseKey(str string) (path orderedmap.Path, sliceAppend bool, err error) {
9696
return path, sliceAppend, err
9797
}
9898

99-
if isNumeric(part) {
100-
v, _ := strconv.Atoi(part)
99+
if v, err := strconv.ParseInt(part, 10, 64); err == nil {
101100
path = append(path, orderedmap.SliceStep(v))
102101
} else {
103102
path = append(path, orderedmap.MapStep(part))
@@ -106,12 +105,3 @@ func parseKey(str string) (path orderedmap.Path, sliceAppend bool, err error) {
106105

107106
return path, sliceAppend, err
108107
}
109-
110-
func isNumeric(s string) bool {
111-
for _, r := range s {
112-
if r < '0' || r > '9' {
113-
return false
114-
}
115-
}
116-
return true
117-
}

0 commit comments

Comments
 (0)