mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-04 15:58:05 +00:00
reduce and :reduce handle empty input identically (#5255)
Fixes #5246. Now the reduce operator and :reduce filter run prefix will both return empty output when their input is empty, so that both can be chained together with the else operator or :else prefix.
This commit is contained in:
@@ -48,7 +48,11 @@ exports.reduce = function(source,operator,options) {
|
||||
accumulator = "" + list[0];
|
||||
}
|
||||
}
|
||||
return [accumulator];
|
||||
if(results.length > 0) {
|
||||
return [accumulator];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user