MCPcopy Create free account
hub / github.com/PowerShell/DSC / redact

Function redact

resources/dscecho/src/main.rs:69–88  ·  view source on GitHub ↗
(value: &Value)

Source from the content-addressed store, hash-verified

67}
68
69pub fn redact(value: &Value) -> Value {
70 if is_secure_value(value) {
71 return Value::String(SECURE_VALUE_REDACTED.to_string());
72 }
73
74 if let Some(map) = value.as_object() {
75 let mut new_map = Map::new();
76 for (key, val) in map {
77 new_map.insert(key.clone(), redact(val));
78 }
79 return Value::Object(new_map);
80 }
81
82 if let Some(array) = value.as_array() {
83 let new_array: Vec<Value> = array.iter().map(redact).collect();
84 return Value::Array(new_array);
85 }
86
87 value.clone()
88}

Callers 1

mainFunction · 0.70

Calls 3

ArrayClass · 0.85
is_secure_valueFunction · 0.70
newFunction · 0.50

Tested by

no test coverage detected