Modify output of some math operators for empty inputs (#9337)

* Initial commit

* Adapt test to new behavior
This commit is contained in:
yaisog
2025-10-29 12:57:39 +01:00
committed by GitHub
parent 059978ec63
commit d58eec47c0
2 changed files with 6 additions and 2 deletions

View File

@@ -217,6 +217,10 @@ function makeNumericReducingOperator(fnCalc,initialValue,fnFinal) {
source(function(tiddler,title) {
result.push($tw.utils.parseNumber(title));
});
// We return an empty array if there are no input titles
if(result.length === 0) {
return [];
}
var value = result.reduce(function(accumulator,currentValue) {
return fnCalc(accumulator,currentValue);
},initialValue);