MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / coerceStringList

Function coerceStringList

skills/models.go:133–157  ·  view source on GitHub ↗
(value any, allowScalar bool)

Source from the content-addressed store, hash-verified

131}
132
133func coerceStringList(value any, allowScalar bool) []string {
134 if value == nil {
135 return nil
136 }
137 if s, ok := value.(string); ok {
138 stripped := strings.TrimSpace(s)
139 if allowScalar && stripped != "" {
140 return []string{stripped}
141 }
142 return nil
143 }
144 values, ok := value.([]any)
145 if !ok {
146 return nil
147 }
148 out := make([]string, 0, len(values))
149 for _, item := range values {
150 text, ok := item.(string)
151 if !ok || strings.TrimSpace(text) == "" {
152 return nil
153 }
154 out = append(out, strings.TrimSpace(text))
155 }
156 return out
157}
158
159func coerceBool(value any, fallback bool) bool {
160 if value == nil {

Callers 1

ValidateFrontmatterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected