Ensure math::sum() returns a number when being called on a non-array value
Closes #65
This commit is contained in:
parent
e4a7ef4afe
commit
48e0380dbe
1 changed files with 1 additions and 1 deletions
|
@ -150,7 +150,7 @@ pub fn stddev(_: &Context, mut args: Vec<Value>) -> Result<Value, Error> {
|
|||
pub fn sum(_: &Context, mut args: Vec<Value>) -> Result<Value, Error> {
|
||||
match args.remove(0) {
|
||||
Value::Array(v) => Ok(v.as_numbers().into_iter().sum::<Number>().into()),
|
||||
_ => Ok(Value::None),
|
||||
v => Ok(v.as_number().into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue