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

cooperator

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

cooperator - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

readme.md

30

index.js
const pushable = require('pull-pushable')
const thunkify = require('./thunkify')
const thunkifyer = require('thunkifyer')
const util = require('util')
const EE = require('events').EventEmitter
function co(gen) {
if(!(this instanceof co)) {
return new co(gen)
function cooperator(gen) {
if(!(this instanceof cooperator)) {
return new cooperator(gen)
}

@@ -20,3 +20,3 @@

}
util.inherits(co, EE)
util.inherits(cooperator, EE)

@@ -36,3 +36,3 @@ ;(function() {

try {
this.handle(this.gen.next(val))
this._handle(this.gen.next(val))
} catch(e) {

@@ -45,3 +45,3 @@ this.emit('error', e)

try {
this.handle(this.gen.throw(err))
this._handle(this.gen.throw(err))
} catch(e) {

@@ -52,3 +52,3 @@ this.emit('error', e)

this.handle = function(res) {
this._handle = function(res) {
try {

@@ -81,7 +81,7 @@ var self = this

try {
res = thunkify(res)
res = thunkifyer(res)
} catch(e) {}
if(isGenerator(res)) {
co(res).on('done', function(val) {
cooperator(res).on('done', function(val) {
self._send(val)

@@ -92,3 +92,3 @@ }).on('error', function(err) {

return
} else if(thunkify.is(res)) {
} else if(thunkifyer.is(res)) {
res(function(err, res) {

@@ -115,5 +115,5 @@ // TODO: what if there are multiple arguments

}
}).call(co.prototype)
}).call(cooperator.prototype)
co.wrap = function(fn, thisVal) {
cooperator.wrap = function(fn, thisVal) {
var res = function() {

@@ -123,3 +123,3 @@ var args = [].slice.call(arguments)

return function(cb) {
return co(fn.apply(thisVal, args)).on('error', function(err) {
return cooperator(fn.apply(thisVal, args)).on('error', function(err) {
if(cb)

@@ -152,2 +152,2 @@ cb(err)

module.exports = co
module.exports = cooperator
{
"name": "cooperator",
"description": "Like co but lets you also output data",
"version": "0.0.0",
"version": "0.0.1",
"author": "CoderPuppy",
"dependencies": {
"thunkifyer": "^0.0.0"
"thunkifyer": "^0.0.0",
"pull-pushable": "^1.1.4"
}
}
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