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

Function opt_str

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

Source from the content-addressed store, hash-verified

326}
327
328fn opt_str(fm: &Map<String, Value>, key: &str) -> Option<String> {
329 match fm.get(key) {
330 Some(Value::String(s)) if !s.is_empty() => Some(s.clone()),
331 Some(Value::Number(n)) => Some(n.to_string()),
332 _ => None,
333 }
334}
335
336fn str_array(fm: &Map<String, Value>, key: &str) -> Vec<String> {
337 match fm.get(key) {

Callers 2

lift_intentFunction · 0.70
require_strFunction · 0.70

Calls 3

getMethod · 0.65
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected