thunkify-wrap
Advanced tools
Comparing version 1.0.2 to 1.0.3
1.0.3 / 2014-10-30 | ||
================== | ||
* support 0.10 | ||
1.0.2 / 2014-07-31 | ||
@@ -3,0 +8,0 @@ ================== |
46
index.js
@@ -8,2 +8,3 @@ /**! | ||
var EventEmitter = require('events').EventEmitter; | ||
var enable = require('enable'); | ||
@@ -111,22 +112,2 @@ /** | ||
/** | ||
* Wrap a regular callback `fn` as a `GeneratorFunction`. | ||
* | ||
* @param {Function} fn | ||
* @param {Object} [ctx] | ||
* @return {Function} | ||
*/ | ||
function genify(fn, ctx) { | ||
if (isGeneratorFunction(fn)) { | ||
return fn; | ||
} | ||
function* genify() { | ||
var thunk = thunkify(fn); | ||
return yield thunk.apply(ctx || this, arguments); | ||
} | ||
return genify; | ||
} | ||
/** | ||
* wrap a event object to a thunk | ||
@@ -172,14 +153,17 @@ * yield to wait the event emit `end`, `close`, `finish` or others | ||
/** | ||
* Expose `thunkify()`. | ||
* @param {Function | Object} input | ||
* @param {Object} [ctx] | ||
* @param {Array} [methods] | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
if (enable.generator) { | ||
/** | ||
* Expose `genify()`. | ||
* @param {Function | Object} input | ||
* @param {Object} [ctx] | ||
* @param {Array} [methods] | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
var genify = require('./genify')(thunkify); | ||
module.exports.genify = function (input, ctx, methods) { | ||
return wrapify(input, ctx, methods, genify); | ||
}; | ||
} | ||
module.exports.genify = function (input, ctx, methods) { | ||
return wrapify(input, ctx, methods, genify); | ||
}; | ||
@@ -186,0 +170,0 @@ function isGeneratorFunction(fn) { |
{ | ||
"name": "thunkify-wrap", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"repository": "dead-horse/node-thunkify-wrap", | ||
@@ -13,3 +13,5 @@ "description": "Turn callbacks, arrays, generators, generator functions, and promises into a thunk", | ||
], | ||
"dependencies": {}, | ||
"dependencies": { | ||
"enable": "1" | ||
}, | ||
"devDependencies": { | ||
@@ -16,0 +18,0 @@ "co-mocha": "*", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10947
8
263
1
+ Addedenable@1
+ Addedenable@1.3.2(transitive)