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

Method take

src/ast.rs:324–330  ·  view source on GitHub ↗

Takes a value from the object by name. Returns `None` when it doesn't exist.

(&mut self, name: &str)

Source from the content-addressed store, hash-verified

322 /// Takes a value from the object by name.
323 /// Returns `None` when it doesn't exist.
324 pub fn take(&mut self, name: &str) -> Option<ObjectProp<'a>> {
325 if let Some(pos) = self.properties.iter().position(|p| p.name.as_str() == name) {
326 Some(self.properties.remove(pos))
327 } else {
328 None
329 }
330 }
331
332 /// Takes a string property value from the object by name.
333 /// Returns `None` when not a string or it doesn't exist.

Callers 6

scanMethod · 0.45
scanMethod · 0.45
remove_comma_separatedFunction · 0.45
ensure_multilineFunction · 0.45
nextMethod · 0.45

Calls 3

iterMethod · 0.80
removeMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected