fn strip_root_field<'a>(filter: &'a str, field: &str) -> Option<&'a str>
Expand description
Strips topmost field name field
from the jsonpath expression filter
,
returning modified filter. If the filter
does not start with the specified
field, returns None.
ⓘ
use openmina_node_native::rpc::strip_root_field;
let filter = strip_root_field("$.field", "field");
assert_eq!(filter, Some(""));
let filter = strip_root_field("$.field.another", "field");
assert_eq!(filter, Some(".another"));
let filter = strip_root_field("$.field_other", "field");
assert_eq!(filter, None);