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

Function opt_str

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

Source from the content-addressed store, hash-verified

226}
227
228fn opt_str(fm: &Map<String, Value>, key: &str) -> Option<String> {
229 match fm.get(key) {
230 Some(Value::String(s)) if !s.is_empty() => Some(s.clone()),
231 Some(Value::Number(n)) => Some(n.to_string()),
232 _ => None,
233 }
234}
235
236fn str_array(fm: &Map<String, Value>, key: &str) -> Vec<String> {
237 match fm.get(key) {

Callers 2

lift_memoryFunction · 0.70
require_strFunction · 0.70

Calls 3

getMethod · 0.65
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected