1
0
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:
Robin Munn
2020-12-11 17:07:52 +07:00
committed by GitHub
parent 6ca89304a1
commit f60d0ef109
5 changed files with 32 additions and 39 deletions

View File

@@ -48,7 +48,11 @@ exports.reduce = function(source,operator,options) {
accumulator = "" + list[0];
}
}
return [accumulator];
if(results.length > 0) {
return [accumulator];
} else {
return [];
}
};
})();