use std::collections::HashMap;
use crate::plugin::ExtensionValue;
pub fn json_str_field(data: &[u8], key: &str) -> Option<String> {
let v: serde_json::Value = serde_json::from_slice(data).ok()?;
v.get(key)?.as_str().map(str::to_string)
}
pub fn member_row(kind: &str, path: &str, component: Option<String>) -> HashMap<String, ExtensionValue> {
let mut f = HashMap::new();
f.insert("member_kind".into(), ExtensionValue::Str(kind.into()));
f.insert("logical_path".into(), ExtensionValue::Str(path.into()));
if let Some(c) = component {
f.insert("component".into(), ExtensionValue::Str(c));
}
f
}