1.0.2 • Published 7 years ago

sequential-map v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

sequential-map

Resolves to a new array with the result of calling a provided promise-returning function with every element in a provided array sequentially.

usage

const sequence = require(`sequential-map`)

// Will resolve after ~4 seconds
sequence(
  message => new Promise(
    resolve => setTimeout(
      resolve.bind(null, message),
      1000
    )
  ),
  [ `they`, `call`, `me`, `Hiphopopotamus` ]
)
.then(console.log)
.catch(console.error)
// [ `they`, `call`, `me`, `Hiphopopotamus` ]

api

sequence(fn[,values][,PromiseImplementation])

  • fn map function
  • values <Array> values to map over
  • PromiseImplementation override the global Promise object