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

Method invoke

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

Source from the content-addressed store, hash-verified

29 }
30
31 fn invoke(&self, args: &[Value], _context: &Context) -> Result<Value, DscError> {
32 debug!("{}", t!("functions.lessOrEquals.invoked"));
33
34 let first = &args[0];
35 let second = &args[1];
36
37 if let (Some(num1), Some(num2)) = (first.as_i64(), second.as_i64()) {
38 return Ok(Value::Bool(num1 <= num2));
39 }
40
41 if let (Some(str1), Some(str2)) = (first.as_str(), second.as_str()) {
42 return Ok(Value::Bool(str1 <= str2));
43 }
44
45 Err(DscError::Parser(t!("functions.typeMismatch").to_string()))
46 }
47}
48
49#[cfg(test)]

Callers

nothing calls this directly

Calls 2

BoolClass · 0.85
as_strMethod · 0.80

Tested by

no test coverage detected