Implement QPromise<Sequence<T>>::reduce(reducer, initialValue)

Iterates over all the promise values (i.e. `Sequence<T>`) and reduces the sequence to a single value using the given `reducer` function and an optional `initialValue`. Also provide a static helper to directly reduce values (`QtPromise::reduce(values, reducer, initialValue)`).
This commit is contained in:
Simon Brunel
2019-02-25 10:07:06 +01:00
parent cbf4cc7867
commit e3f0f054af
15 changed files with 763 additions and 6 deletions

View File

@ -33,6 +33,7 @@ module.exports = {
'qtpromise/qpromise/ispending',
'qtpromise/qpromise/isrejected',
'qtpromise/qpromise/map',
'qtpromise/qpromise/reduce',
'qtpromise/qpromise/tap',
'qtpromise/qpromise/tapfail',
'qtpromise/qpromise/then',
@ -51,6 +52,7 @@ module.exports = {
'qtpromise/helpers/each',
'qtpromise/helpers/filter',
'qtpromise/helpers/map',
'qtpromise/helpers/reduce',
'qtpromise/helpers/resolve'
]
},