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

es6-promise-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

es6-promise-series - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

index2.test.js

24

index.js
"use strict";
module.exports = function(Promise) {
Promise.series = function (promises, concurrent) {
function promiseSupported(Promise){
return typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1;
}
module.exports = function(_Promise) {
if (!promiseSupported(Promise)){
throw new Error("Promise not supported");
}
if (_Promise && typeof _Promise.all === "function" && typeof _Promise.race === "function"){
return arguments[0].series = series;
} else {
return series.apply(this, arguments);
}
};
function series (promises, concurrent) {
var results = null;

@@ -45,3 +62,2 @@ promises = promises.slice();

});
};
};
}

4

package.json
{
"name": "es6-promise-series",
"version": "0.1.1",
"version": "0.2.0",
"description": "Execute promises in series",
"main": "index.js",
"scripts": {
"test": "node node_modules/.bin/mocha index.test.js"
"test": "_mocha *.test.js"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -7,2 +7,4 @@ [![Build Status](https://travis-ci.org/der-On/es6-promise-series.svg)](https://travis-ci.org/der-On/es6-promise-series)

Usage
```javascript

@@ -15,2 +17,22 @@ /**

*/
import series from 'series'
series([
aPromise,
anotherPromise
], 4)
.then(function (results) {
...
});
```
Old usage
```javascript
/**
* Runs promises in series
* @param {Array} list of promises or functions returning promises
* @param {Number} (optional) number of concurrent promises, of omitted no concurrency will happen
* @return {Promise}
*/
Promise.series([

@@ -24,1 +46,2 @@ aPromise,

```
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