Count the hook commands carried by a single entry (nested or flat).
(entry: &Value)
| 343 | |
| 344 | /// Count the hook commands carried by a single entry (nested or flat). |
| 345 | fn count_commands(entry: &Value) -> usize { |
| 346 | if let Some(inner) = entry.get("hooks").and_then(Value::as_array) { |
| 347 | return inner.iter().filter(|h| entry_has_command(h)).count(); |
| 348 | } |
| 349 | usize::from(entry_has_command(entry)) |
| 350 | } |
| 351 | |
| 352 | /// Deep-merge `extra` into `root`: objects merge recursively, arrays union by |
| 353 | /// value (no duplicates), scalars overwrite. Used for non-hook settings such |
no test coverage detected