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

Method invoke

lib/dsc-lib/src/functions/map.rs:32–44  ·  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 debug!("{}", t!("functions.map.invoked"));
34
35 let array = args[0].as_array().unwrap();
36 let lambda_id = args[1].as_str().unwrap();
37 let lambdas = get_lambda(context, lambda_id, "map")?;
38 let lambda = lambdas.get(lambda_id).unwrap();
39 let result_array = apply_lambda_to_array(array, lambda, context, |result, _element| {
40 Ok(Some(result))
41 })?;
42
43 Ok(Value::Array(result_array))
44 }
45}

Callers

nothing calls this directly

Calls 5

get_lambdaFunction · 0.85
apply_lambda_to_arrayFunction · 0.85
ArrayClass · 0.85
as_strMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected