Skip to content

Returns a promise containing the reduced result from the provided function

Notifications You must be signed in to change notification settings

notjrbauer/promise.reduce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promise.reduce

"Returns a promise containing the reduced result from the provided function"

NPM

Install

$ npm install promise.reduce --save

Usage

var map = require('promise.reduce')
var conat = (total, current) => Promise.resolve(total + current)

reduce([
  'a',
  'b',
  Promise.resolve('c')
], concat).then((result) => {
  console.log(result) // 'abc'
})

API

reduce(input..., reducerFn, initialValue) -> promise

Returns a promise containing the reduced result of the promisified mappingFn on its elements. Rejection occurs if any supplied promises reject.

input Iterable<Promise|any>

A sequence of promises or instanceof Iterable

mapperFn Function

A mapping function that returns a promise

initialValue Function

The initial value used in the reduction invocation

About

Returns a promise containing the reduced result from the provided function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published