The canonical `memoryKind`, accepting legacy `kind`/`type` fields.
(frontmatter_json: &str)
| 244 | |
| 245 | /// The canonical `memoryKind`, accepting legacy `kind`/`type` fields. |
| 246 | fn frontmatter_kind(frontmatter_json: &str) -> String { |
| 247 | serde_json::from_str::<serde_json::Value>(frontmatter_json) |
| 248 | .ok() |
| 249 | .and_then(|v| { |
| 250 | ["memoryKind", "kind", "type"] |
| 251 | .iter() |
| 252 | .find_map(|key| v.get(key).and_then(|value| value.as_str())) |
| 253 | .map(String::from) |
| 254 | }) |
| 255 | .unwrap_or_else(|| "project".to_string()) |
| 256 | } |
| 257 | |
| 258 | fn frontmatter_status(frontmatter_json: &str) -> Option<String> { |
| 259 | let value = serde_json::from_str::<serde_json::Value>(frontmatter_json).ok()?; |
no test coverage detected