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

Method invoke

lib/dsc-lib/src/functions/if.rs:32–42  ·  view source on GitHub ↗
(&self, args: &[Value], _context: &Context)

Source from the content-addressed store, hash-verified

30 }
31
32 fn invoke(&self, args: &[Value], _context: &Context) -> Result<Value, DscError> {
33 let Some(condition) = args[0].as_bool() else {
34 return Err(DscError::Function("if".to_string(), t!("functions.if.conditionNotBoolean").to_string()));
35 };
36
37 if condition {
38 Ok(args[1].clone())
39 } else {
40 Ok(args[2].clone())
41 }
42 }
43}
44
45#[cfg(test)]

Callers

nothing calls this directly

Calls 1

FunctionInterface · 0.70

Tested by

no test coverage detected