MCPcopy Create free account
hub / github.com/WICG/webpackage / parseListOfStringLists

Function parseListOfStringLists

go/bundle/encoder.go:274–296  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

272}
273
274func parseListOfStringLists(s string) ([][]string, error) {
275 ll, err := structuredheader.ParseListOfLists(s)
276 if err != nil {
277 return nil, err
278 }
279 // Convert [][]structuredheader.Item to [][]string.
280 var result [][]string
281 for _, l := range ll {
282 var sl []string
283 for _, item := range l {
284 switch v := item.(type) {
285 case string:
286 sl = append(sl, v)
287 case structuredheader.Token:
288 sl = append(sl, string(v))
289 default:
290 return nil, fmt.Errorf("unexpected value of type %T", v)
291 }
292 }
293 result = append(result, sl)
294 }
295 return result, nil
296}
297
298// Variants represents a Variants: header value.
299type Variants [][]string

Callers 2

parseVariantsFunction · 0.85

Calls 1

ParseListOfListsFunction · 0.92

Tested by

no test coverage detected