+3
-1
| language: node_js | ||
| node_js: | ||
| - "iojs" | ||
| - "stable" | ||
| - "4.2" | ||
| - "4.0" | ||
| - "0.12" | ||
@@ -5,0 +7,0 @@ - "0.11" |
+5
-0
@@ -0,1 +1,6 @@ | ||
| # prfun 2.1.2 (2015-11-20) | ||
| * Ensure that `Promise.async` always returns a `Promise`. | ||
| (Previously if the function returned immediately without yielding | ||
| the result would not be wrapped in a promise.) | ||
| # prfun 2.1.1 (2014-04-28) | ||
@@ -2,0 +7,0 @@ * Improve compatibilty with environments missing a definition of |
+1
-1
@@ -644,3 +644,3 @@ // Utility functions for ES6 Promises. | ||
| if (result.done) { | ||
| return result.value; | ||
| return P.resolve(result.value); | ||
| } else { | ||
@@ -647,0 +647,0 @@ return P.resolve(result.value).then(callback, errback); |
+10
-8
| { | ||
| "name": "prfun", | ||
| "version": "2.1.1", | ||
| "version": "2.1.2", | ||
| "description": "Helper functions for ES6 promises", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "mocha": "if which iojs ; then mocha ; else mocha --harmony-generators; fi", | ||
| "test": "jshint . && jscs . && npm run mocha" | ||
| "lint": "jshint . && jscs .", | ||
| "lint-no-0.8": "node -e 'process.exit(/v0[.][0-8][.]/.test(process.version) ? 0 : 1)' || npm run lint", | ||
| "mocha": "if node -e 'process.exit(/v0[.]([0-9]|10)[.]/.test(process.version) ? 0 : 1)' ; then mocha ; else mocha --harmony ; fi", | ||
| "test": "npm run lint-no-0.8 && npm run mocha" | ||
| }, | ||
@@ -27,10 +29,10 @@ "repository": { | ||
| "devDependencies": { | ||
| "core-js": "~0.9.1", | ||
| "jscs": "~1.13.0", | ||
| "jshint": "~2.7.0", | ||
| "mocha": "~2.2.4" | ||
| "core-js": "~1.2.6", | ||
| "jscs": "~2.6.0", | ||
| "jshint": "~2.8.0", | ||
| "mocha": "~2.3.4" | ||
| }, | ||
| "optionalDependencies": { | ||
| "core-js": "~0.9.1" | ||
| "core-js": "~1.2.6" | ||
| } | ||
| } |
+13
-1
@@ -6,3 +6,6 @@ // jscs:disable maximumLineLength | ||
| // Bail if we're not running in node >= 0.11 | ||
| var node11 = parseInt(process.versions.node.split('.')[1], 10) >= 11; | ||
| var ver = process.versions.node.split('.').map(function(s) { | ||
| return parseInt(s, 10); | ||
| }); | ||
| var node11 = ver[0] > 0 || ver[1] >= 11; | ||
| if (!node11) { return; } | ||
@@ -143,2 +146,3 @@ | ||
| MyClass.prototype.noOp = Promise.async(eval('(function*(){})')); | ||
| MyClass.prototype.spawnGoblins = Promise.async(eval('(function*(){' + | ||
@@ -149,2 +153,10 @@ ' this.goblins = yield get(this.goblins+1);' + | ||
| specify('should always return a promise', function() { | ||
| var a = new MyClass(); | ||
| assert(a.noOp() instanceof Promise); | ||
| return a.noOp().then(function(v) { | ||
| assert.equal(v, undefined); | ||
| }); | ||
| }); | ||
| specify("generator function's receiver should be the instance too", function() { | ||
@@ -151,0 +163,0 @@ var a = new MyClass(); |
199342
0.4%4602
0.24%9
12.5%