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

co

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

14

benchmark.js

@@ -26,2 +26,10 @@

yield fun;
}, done);
},
'function delegation thunk': function(done){
co(function *(){
yield fun;
yield fun;
yield fun;
})(done);

@@ -33,3 +41,3 @@ },

yield [fun, fun, fun];
})(done);
}, done);
},

@@ -42,3 +50,3 @@

yield getPromise(3);
})(done);
}, done);
},

@@ -51,3 +59,3 @@

yield gen;
})(done);
}, done);
}

@@ -54,0 +62,0 @@ };

1.5.1 / 2013-08-11
==================
* remove setImmediate() usage - ~110% perf increase. Closes #14
0.5.0 / 2013-08-10

@@ -3,0 +8,0 @@ ==================

@@ -15,5 +15,7 @@

/**
* Wrap the given generator `fn`.
* Wrap the given generator `fn` with
* optional `done` callback.
*
* @param {Function} fn
* @param {Function} [done]
* @return {Function}

@@ -23,7 +25,5 @@ * @api public

function co(fn, ctx) {
var args = [].slice.call(arguments, 1);
var gen = isGenerator(fn) ? fn : fn.apply(this, args);
function co(fn, done, ctx) {
var gen = isGenerator(fn) ? fn : fn.call(this);
ctx = ctx || this;
var done;

@@ -83,3 +83,4 @@ function next(err, res) {

setImmediate(next);
if (done) next();
else setImmediate(next);

@@ -171,7 +172,8 @@ return function(fn){

function toThunk(obj, ctx) {
if (Array.isArray(obj)) obj = exports.join.call(ctx, obj);
var fn = obj;
if (Array.isArray(obj)) fn = exports.join.call(ctx, obj);
if (isGeneratorFunction(obj)) obj = obj.call(ctx);
if (isGenerator(obj)) obj = co(obj, ctx);
if (isPromise(obj)) obj = promiseToThunk(obj);
return obj;
if (isGenerator(obj)) fn = function(done){ co(obj, done, ctx) };
if (isPromise(obj)) fn = promiseToThunk(obj);
return fn;
}

@@ -178,0 +180,0 @@

{
"name": "co",
"version": "1.5.0",
"version": "1.5.1",
"description": "generator async flow control goodness",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,10 +22,3 @@

})
it('should pass arguments', function(done){
co(function *(a, b, c){
[a, b, c].should.eql([1,2,3]);
done();
}, 1, 2, 3);
})
describe('with no yields', function(){

@@ -32,0 +25,0 @@ it('should work', function(done){

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