sequential processing of data through a promise yielding function
npm install sequential-mapResolves to a new array with the result of calling a provided promise-returning function with every element in a provided array sequentially.
``javascriptsequential-map
const sequence = require()
// Will resolve after ~4 seconds
sequence(
message => new Promise(
resolve => setTimeout(
resolve.bind(null, message),
1000
)
),
[ they, call, me, Hiphopopotamus ]they
)
.then(console.log)
.catch(console.error)
// [ , call, me, Hiphopopotamus ]`
- fn map functionvalues
- <Array> values to map overPromiseImplementation` override the global Promise object
-