promise-map-series
Advanced tools
Comparing version 0.2.3 to 0.3.0
# master | ||
# 0.3.0 | ||
* [BREAKING] Drop support for any node but `10.* || >= 12.*` | ||
* Use async/await directly | ||
* Drop RSVP | ||
* Upgrade Test Dependencies | ||
# 0.2.3 | ||
@@ -4,0 +11,0 @@ |
19
index.js
@@ -1,16 +0,11 @@ | ||
var Promise = require('rsvp').Promise; | ||
module.exports = async function promiseMapSeries(array, iterator, thisArg) { | ||
const length = array.length; | ||
const cb = arguments.length > 2 ? iterator.bind(thisArg) : iterator; | ||
const results = new Array(length); | ||
module.exports = function promiseMapSeries(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)) | ||
for (let i = 0; i < length; ++i) { | ||
results[i] = await cb(array[i], i, array); | ||
} | ||
return Promise.all(results) | ||
return results; | ||
} |
{ | ||
"name": "promise-map-series", | ||
"description": "Map over array avoiding parallel execution, using promises", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"author": "Jo Liss <joliss42@gmail.com>", | ||
"main": "index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"license": "MIT", | ||
@@ -15,8 +12,8 @@ "repository": { | ||
}, | ||
"dependencies": { | ||
"rsvp": "^3.0.14" | ||
}, | ||
"devDependencies": { | ||
"tape": "^2.5.0" | ||
"tape": "^4.11.0" | ||
}, | ||
"engines": { | ||
"node": "10.* || >= 12.*" | ||
}, | ||
"scripts": { | ||
@@ -23,0 +20,0 @@ "test": "tape test.js" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14127
0
6
9
1
- Removedrsvp@^3.0.14
- Removedrsvp@3.6.2(transitive)