Extra methods for promises for arrays
npm install then-array
ArrayPromise
inherits the entire API of promise but all methods return instances of ArrayPromise
where they would've returned instances of Promise
. Those methods are:
ArrayPromise.from(value)
ArrayPromise.all(array) / Promise.all(a, b, c, ...)
ArrayPromise.denodeify(fn)
ArrayPromise.nodeify(fn)
ArrayPromise#then(onFulfilled, onRejected)
ArrayPromise#done(onFulfilled, onRejected)
ArrayPromise#nodeify(callback)
In addition, the following methods are provided with APIs that correspond to the Array equivallents but which support promises everywhere:
ArrayPromise#reverse()
returns a promise for a new array with the elements reversedArrayPromise#concat(args...)
if args are arrays or promises for arrays it will return a promise for all the arrays concatenated together.ArrayPromise#slice(begin[, end])
return a promise for that portion of the arrayArrayPromise#map(fn)
parallel, promised mapArrayPromise#filter(fn)
parallel, promised filterArrayPromise#reduce(fn[, initial])
promised reduceArrayPromise#reduceRight(fn[, initial])
promised reduceRight
MIT