Extract the canonical `memoryKind`, accepting legacy `kind`/`type` fields.
(frontmatter_json: &str)
| 611 | |
| 612 | /// Extract the canonical `memoryKind`, accepting legacy `kind`/`type` fields. |
| 613 | fn frontmatter_kind(frontmatter_json: &str) -> String { |
| 614 | serde_json::from_str::<serde_json::Value>(frontmatter_json) |
| 615 | .ok() |
| 616 | .and_then(|v| { |
| 617 | ["memoryKind", "kind", "type"] |
| 618 | .iter() |
| 619 | .find_map(|key| v.get(key).and_then(|value| value.as_str())) |
| 620 | .map(String::from) |
| 621 | }) |
| 622 | .unwrap_or_else(|| "project".to_string()) |
| 623 | } |
| 624 | |
| 625 | fn frontmatter_status(frontmatter_json: &str) -> Option<String> { |
| 626 | let value = serde_json::from_str::<serde_json::Value>(frontmatter_json).ok()?; |
no test coverage detected