Takes a value from the object by name. Returns `None` when it doesn't exist.
(&mut self, name: &str)
| 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. |
no test coverage detected