MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / str_array

Function str_array

atomic-canonical/src/lift.rs:263–276  ·  view source on GitHub ↗
(fm: &Map<String, Value>, key: &str)

Source from the content-addressed store, hash-verified

261}
262
263fn str_array(fm: &Map<String, Value>, key: &str) -> Vec<String> {
264 match fm.get(key) {
265 Some(Value::Array(items)) => items
266 .iter()
267 .filter_map(|v| v.as_str().map(str::to_string))
268 .collect(),
269 Some(Value::String(s)) if !s.is_empty() => s
270 .split(',')
271 .map(|p| p.trim().to_string())
272 .filter(|p| !p.is_empty())
273 .collect(),
274 _ => Vec::new(),
275 }
276}
277
278/// Minimal frontmatter splitter for a full markdown document:
279/// `---\n<key: value lines>\n---\n<body>`. Enough for templates and the CLI;

Callers 1

lift_intentFunction · 0.70

Calls 4

getMethod · 0.65
iterMethod · 0.45
as_strMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected