MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / normalize_path

Function normalize_path

nodedb/src/engine/document/store/extract.rs:6–10  ·  view source on GitHub ↗

JSON / MessagePack conversion and secondary-index value extraction. Strip the leading `$.` or `$` prefix from a JSON path expression.

(path: &str)

Source from the content-addressed store, hash-verified

4
5/// Strip the leading `$.` or `$` prefix from a JSON path expression.
6pub(crate) fn normalize_path(path: &str) -> &str {
7 path.strip_prefix("$.")
8 .or_else(|| path.strip_prefix('$'))
9 .unwrap_or(path)
10}
11
12/// Extract scalar values at a JSON path for secondary indexing.
13pub fn extract_index_values(doc: &serde_json::Value, path: &str, is_array: bool) -> Vec<String> {

Callers 2

extract_index_valuesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected