Add range to the math reductions (#296)

This commit is contained in:
JT
2021-11-06 20:12:08 +13:00
committed by GitHub
parent 02b8027749
commit d401ed64ed
3 changed files with 32 additions and 19 deletions

View File

@ -84,6 +84,14 @@ pub fn calculate(
Err(err) => Err(err),
}
}
PipelineData::Value(Value::Range { val, .. }) => {
let new_vals: Result<Vec<Value>, ShellError> = val
.into_range_iter()?
.map(|val| mf(&[val], &name))
.collect();
mf(&new_vals?, &name)
}
PipelineData::Value(val) => mf(&[val], &name),
}
}