MCPcopy Create free account
hub / github.com/github/gh-aw / parseCommaSeparatedOrNewlineList

Function parseCommaSeparatedOrNewlineList

pkg/workflow/tools_parser.go:66–78  ·  view source on GitHub ↗

parseCommaSeparatedOrNewlineList splits a string by commas and/or newlines, trims surrounding whitespace from each item, and discards empty items.

(s string)

Source from the content-addressed store, hash-verified

64// parseCommaSeparatedOrNewlineList splits a string by commas and/or newlines,
65// trims surrounding whitespace from each item, and discards empty items.
66func parseCommaSeparatedOrNewlineList(s string) []string {
67 // Normalize newlines to commas, then split on comma.
68 normalized := strings.ReplaceAll(s, "\n", ",")
69 parts := strings.Split(normalized, ",")
70 result := make([]string, 0, len(parts))
71 for _, p := range parts {
72 p = strings.TrimSpace(p)
73 if p != "" {
74 result = append(result, p)
75 }
76 }
77 return result
78}
79
80// toAnySlice converts a []string to []any for storage in a map[string]any.
81func toAnySlice(ss []string) []any {

Callers 1

parseGitHubToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected