New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-co

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-co - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

cargo.js

4

each.js

@@ -5,5 +5,5 @@ "use strict";

module.exports = function *(series, thunk) {
yield eachLimit(series, series.length, thunk);
module.exports = function *(series, thunk, ctx) {
yield eachLimit(series, series.length, thunk, ctx);
};
"use strict";
module.exports = function *(series, n, thunk) {
module.exports = function *(series, n, thunk, ctx) {
var n = Math.min(n || 5, series.length);

@@ -16,3 +16,3 @@

let i = index++;
ret[i] = yield thunk(series[i]);
ret[i] = yield thunk.call(ctx || this, series[i]);

@@ -19,0 +19,0 @@ yield next; //continue in lane

@@ -5,5 +5,5 @@ "use strict";

module.exports = function *(series, thunk) {
yield eachOfLimit(series, Object.keys(series).length, thunk);
module.exports = function *(series, thunk, ctx) {
yield eachOfLimit(series, Object.keys(series).length, thunk, ctx);
};

@@ -5,8 +5,8 @@ "use strict";

module.exports = function *(series, n, thunk){
module.exports = function *(series, n, thunk, ctx){
yield eachLimit(Object.keys(series), n, function* (k){
yield thunk(series[k], k);
});
}, ctx);
};

@@ -6,5 +6,5 @@ "use strict";

//what did you expect..
module.exports = function (series, thunk){
return eachOfLimit(series, 1, thunk);
module.exports = function (series, thunk, ctx){
return eachOfLimit(series, 1, thunk, ctx);
};

@@ -6,5 +6,5 @@ "use strict";

//what did you expect..
module.exports = function (series, thunk){
return eachLimit(series, 1, thunk);
module.exports = function (series, thunk, ctx){
return eachLimit(series, 1, thunk, ctx);
};
{
"name": "async-co",
"version": "1.0.1",
"version": "1.1.0",
"description": "Control flow for co with async.js (v2) signatures",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,7 +8,2 @@ "use strict";

var push = function * (task) {
var delayed = yield process(task);
return delayed;
}
var process = function *(task) {

@@ -35,3 +30,5 @@ yield pickworker();

return { push };
var out = process; // better candidate than {}
out.push = process; // per compatibility
return out;
}

@@ -1,27 +0,29 @@

Control flow for ES6 generator (co) with async.js (v2) signatures
Control flow ala ES7 async/await using ES6 generator (thanks to [tj/co](https://github.com/tj/co)) with async.js (v2) signatures
# Motivation
async-co provide javascript async/await (through ES6 generator & co) equivalent signatures of the excellent [async](https://github.com/caolan/async) workflow library.
[async-co](https://github.com/131/async-co) provide javascript async/await (through ES6 generator & co) equivalent signatures of the excellent [async](https://github.com/caolan/async) workflow library.
**async-co** is not a wrapper on **async**, but rather leverages the full potential of native async/await & promises contract. Code tend to be small & very efficient (far more simplier than using callbacks), just give [async-co/queue.js](https://github.com/131/async-co/blob/master/queue.js) a look
## Addition to the async library signatures
Because of the Promise contract (and sane API), it's easy to "throttle" a function that return a Promise (see the "throttle" API, for a way to make an ultra simple http request pooling).
## Addition to the async library signatures / promise pooling
Per design, it's easy to "throttle" a function that return a Promise ; checkout the "throttle" API for a way to make an ultra simple http request pooling.
# API
## async-co/eachLimit(arr, concurrency, *thunk)
## async-co/eachLimit(arr, concurrency, *thunk [, thisobj])
Nothing special here
## async-co/eachSeries(arr, *thunk)
## async-co/eachSeries(arr, *thunk [, thisobj] )
// = eachLimit concurrency = 1
## async-co/each(arr, *thunk)
## async-co/each(arr, *thunk [, thisobj])
// = eachLimit concurrency = arr.length
## async-co/eachOfLimit (dict, concurrency, *thunk)
## async-co/eachOfLimit (dict, concurrency, *thunk [, thisobj])
Nothing special here neither
## async-co/eachOfSeries(dict, *thunk)
## async-co/eachOfSeries(dict, *thunk [, thisobj])
// = eachOfLimit concurrency = 1
## async-co/eachOf(dict, *thunk)
## async-co/eachOf(dict, *thunk [, thisobj])
// = eachOfLimit concurrency = dict.length

@@ -86,5 +88,5 @@

* Get rich or die tryin'
* write a working async-co/cargo (see [the challenge on stackoverflow](http://stackoverflow.com/questions/39069624))
# Credits
* [131](https://github.com/131)

@@ -94,4 +96,9 @@ * not dependant upon, yet relying on [co](https://github.com/tj/co)

## Alternatives / relatives
* [koa-async](https://github.com/eladnava/koa-async) ; a clever Promisify wrapper on top of async (but not leveraging the full potential of ES7 async/await capabilities)
* [caolan/async/asyncify.js](https://github.com/caolan/async/blob/master/lib/asyncify.js) goes the same as koa-async.
* [es6-promise-pool](https://github.com/timdp/es6-promise-pool) ; equivalent to async-co/queue, with a different API
# Shoutbox, keywords, SEO love

@@ -98,0 +105,0 @@ async/await, ES6 generators, co, async-co, promise, Promises, yield, async, queue, map, throttle, "Let's have a beer & talk in Paris"

@@ -9,5 +9,5 @@ "use strict";

return function () {
return q.push([].slice.apply(arguments));
return q([].slice.apply(arguments));
};
}
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