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

Method insert_or_append

src/cst/mod.rs:1770–1780  ·  view source on GitHub ↗
(&self, index: Option<usize>, prop_name: &str, value: CstInputValue)

Source from the content-addressed store, hash-verified

1768 }
1769
1770 fn insert_or_append(&self, index: Option<usize>, prop_name: &str, value: CstInputValue) -> CstObjectProp {
1771 self.ensure_multiline();
1772 insert_or_append_to_container(
1773 &CstContainerNode::Object(self.clone()),
1774 self.properties().into_iter().map(|c| c.into()).collect(),
1775 index,
1776 InsertValue::Property(prop_name, value),
1777 )
1778 .as_object_prop()
1779 .unwrap()
1780 }
1781
1782 /// Replaces this node with a new value.
1783 pub fn replace_with(self, replacement: CstInputValue) -> Option<CstNode> {

Callers 2

appendMethod · 0.80
insertMethod · 0.80

Calls 9

ObjectClass · 0.85
ArrayClass · 0.85
ValueEnum · 0.85
ensure_multilineMethod · 0.80
into_iterMethod · 0.80
propertiesMethod · 0.80
elementsMethod · 0.80
as_object_propMethod · 0.45

Tested by

no test coverage detected