Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

promise-map-series

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-map-series - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

CHANGELOG.md
# master
# 0.2.1
* Improve performance
# 0.2.0

@@ -4,0 +8,0 @@

29

index.js

@@ -1,17 +0,16 @@

var RSVP = require('rsvp')
var Promise = require('rsvp').Promise;
module.exports = function promiseMapSeries (array, iterator, thisArg) {
var results = new Array(array.length)
var index = 0
return array.reduce(function (promise, item) {
return promise.then(function () {
return iterator.call(thisArg, item, index, array)
})
.then(function (result) {
results[index++] = result
})
}, RSVP.resolve())
.then(function () {
return results
})
module.exports = function sequence(array, iterator, thisArg) {
var length = array.length
var current = Promise.resolve()
var results = new Array(length)
var cb = arguments.length > 2 ? iterator.bind(thisArg) : iterator
for (var i = 0; i < length; ++i) {
current = results[i] = current.then(function(i) {
return cb(array[i], i, array)
}.bind(undefined, i))
}
return Promise.all(results)
}
{
"name": "promise-map-series",
"description": "Map over array avoiding parallel execution, using promises",
"version": "0.2.0",
"version": "0.2.1",
"author": "Jo Liss <joliss42@gmail.com>",

@@ -13,3 +13,3 @@ "main": "index.js",

"dependencies": {
"rsvp": "^3.0.6"
"rsvp": "^3.0.14"
},

@@ -16,0 +16,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc