Socket
Socket
Sign inDemoInstall

p-each-series

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-each-series - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

index.d.ts

15

index.js
'use strict';
const pReduce = require('p-reduce');
module.exports = (iterable, iterator) => pReduce(iterable, (a, b, i) => iterator(b, i)).then(() => iterable);
const pEachSeries = async (iterable, iterator) => {
let index = 0;
for (const value of iterable) {
// eslint-disable-next-line no-await-in-loop
await iterator(await value, index++);
}
return iterable;
};
module.exports = pEachSeries;
module.exports.default = pEachSeries;

94

package.json
{
"name": "p-each-series",
"version": "1.0.0",
"description": "Iterate over promises serially",
"license": "MIT",
"repository": "sindresorhus/p-each-series",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"promise",
"foreach",
"for-each",
"for",
"each",
"collection",
"iterable",
"iterator",
"fulfilled",
"async",
"await",
"promises",
"serial",
"serially",
"series",
"bluebird"
],
"dependencies": {
"p-reduce": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"delay": "^1.3.1",
"time-span": "^1.0.0",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "p-each-series",
"version": "2.0.0",
"description": "Iterate over promises serially",
"license": "MIT",
"repository": "sindresorhus/p-each-series",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd-check"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"promise",
"foreach",
"for-each",
"for",
"each",
"collection",
"iterable",
"iterator",
"fulfilled",
"async",
"await",
"promises",
"serial",
"serially",
"series",
"bluebird"
],
"devDependencies": {
"ava": "1.3.1",
"delay": "^4.1.0",
"time-span": "^3.0.0",
"tsd-check": "^0.3.0",
"xo": "^0.24.0"
}
}

@@ -11,3 +11,3 @@ # p-each-series [![Build Status](https://travis-ci.org/sindresorhus/p-each-series.svg?branch=master)](https://travis-ci.org/sindresorhus/p-each-series)

```
$ npm install --save p-each-series
$ npm install p-each-series
```

@@ -27,8 +27,8 @@

const iterator = el => saveToDiskPromise(el); //=> Promise
const iterator = async el => saveToDiskPromise(el);
pEachSeries(keywords, iterator).then(result => {
console.log(result);
(async () => {
console.log(await pEachSeries(keywords, iterator));
//=> ['unicorn', 'rainbow', 'pony']
});
})();
```

@@ -45,3 +45,3 @@

Type: `Iterable<Promise|any>`
Type: `Iterable<Promise | unknown>`

@@ -60,3 +60,5 @@ Iterated over serially in the `iterator` function.

- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially
- [p-series](https://github.com/sindresorhus/p-series) - Run promise-returning & async functions in series
- [p-pipe](https://github.com/sindresorhus/p-pipe) - Compose promise-returning & async functions into a reusable pipeline
- [p-waterfall](https://github.com/sindresorhus/p-waterfall) - Run promise-returning & async functions in series, each passing its result to the next
- [p-reduce](https://github.com/sindresorhus/p-reduce) - Reduce a list of values using promises into a promise for a value

@@ -63,0 +65,0 @@ - [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently

Sorry, the diff of this file is not supported yet

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