MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / StringsFromNode

Function StringsFromNode

internal/node/node.go:463–478  ·  view source on GitHub ↗

StringsFromNode returns a string slice based on a scalar with a CSV or a sequence.

(n *yaml.Node)

Source from the content-addressed store, hash-verified

461
462// StringsFromNode returns a string slice based on a scalar with a CSV or a sequence.
463func StringsFromNode(n *yaml.Node) []string {
464 if n == nil {
465 return nil
466 }
467 if n.Kind == yaml.ScalarNode {
468 return strings.Split(n.Value, ",")
469 }
470 if n.Kind == yaml.SequenceNode {
471 retval := make([]string, 0)
472 for _, s := range n.Content {
473 retval = append(retval, s.Value)
474 }
475 return retval
476 }
477 return nil
478}
479
480// Append appends to node.Content
481func Append(n *yaml.Node, a *yaml.Node) {

Callers 1

getMapKeysFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected