mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-25 05:04:41 +00:00
Modify output of some math operators for empty inputs (#9337)
* Initial commit * Adapt test to new behavior
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user