MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / get

Method get

src/cst/mod.rs:1725–1740  ·  view source on GitHub ↗

Property by name. Returns `None` if the property doesn't exist.

(&self, name: &str)

Source from the content-addressed store, hash-verified

1723 ///
1724 /// Returns `None` if the property doesn't exist.
1725 pub fn get(&self, name: &str) -> Option<CstObjectProp> {
1726 for child in &self.0.borrow().value {
1727 if let CstNode::Container(CstContainerNode::ObjectProp(prop)) = child {
1728 let Some(prop_name) = prop.name() else {
1729 continue;
1730 };
1731 let Ok(prop_name_str) = prop_name.decoded_value() else {
1732 continue;
1733 };
1734 if prop_name_str == name {
1735 return Some(prop.clone());
1736 }
1737 }
1738 }
1739 None
1740 }
1741
1742 /// Properties of the object.
1743 pub fn properties(&self) -> Vec<CstObjectProp> {

Callers 15

set_valueMethod · 0.45
array_valueMethod · 0.45
array_value_or_createMethod · 0.45
array_value_or_setMethod · 0.45
object_valueMethod · 0.45
object_value_or_setMethod · 0.45
modify_valuesFunction · 0.45
run_testFunction · 0.45
array_ensure_multilineFunction · 0.45
object_ensure_multilineFunction · 0.45

Calls 2

nameMethod · 0.80
decoded_valueMethod · 0.80