then-array

Extra methods for promises for arrays

npm install then-array
2 downloads in the last week
4 downloads in the last month

then-array

Extra methods for promises for arrays

Build Status Dependency Status NPM version

Installation

npm install then-array

API

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 reversed
  • ArrayPromise#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 array
  • ArrayPromise#map(fn) parallel, promised map
  • ArrayPromise#filter(fn) parallel, promised filter
  • ArrayPromise#reduce(fn[, initial]) promised reduce
  • ArrayPromise#reduceRight(fn[, initial]) promised reduceRight

License

MIT

npm loves you