Extract the canonical `memoryKind`, accepting legacy `kind`/`type` fields.
(frontmatter_json: &str)
| 665 | |
| 666 | /// Extract the canonical `memoryKind`, accepting legacy `kind`/`type` fields. |
| 667 | fn frontmatter_kind(frontmatter_json: &str) -> String { |
| 668 | serde_json::from_str::<serde_json::Value>(frontmatter_json) |
| 669 | .ok() |
| 670 | .and_then(|v| { |
| 671 | ["memoryKind", "kind", "type"] |
| 672 | .iter() |
| 673 | .find_map(|key| v.get(key).and_then(|value| value.as_str())) |
| 674 | .map(String::from) |
| 675 | }) |
| 676 | .unwrap_or_else(|| "project".to_string()) |
| 677 | } |
| 678 | |
| 679 | fn frontmatter_status(frontmatter_json: &str) -> Option<String> { |
| 680 | let value = serde_json::from_str::<serde_json::Value>(frontmatter_json).ok()?; |
no test coverage detected