Comparing version 0.7.4 to 0.7.5
/* | ||
Yaku v0.7.4 | ||
Yaku v0.7.5 | ||
(c) 2015 Yad Smood. http://ysmood.org | ||
@@ -4,0 +4,0 @@ License MIT |
/* | ||
Yaku v0.7.4 | ||
Yaku v0.7.5 | ||
(c) 2015 Yad Smood. http://ysmood.org | ||
@@ -255,3 +255,3 @@ License MIT | ||
* var download = utils.flow(createUrl, curl, save); | ||
* # same as "download = utils.flow([createUrl, curl, save])" | ||
* // same as "download = utils.flow([createUrl, curl, save])" | ||
* | ||
@@ -351,6 +351,6 @@ * download('home'); | ||
* bar(0).then((val) => { | ||
* console.log val # output => 1 | ||
* console.log val // output => 1 | ||
* }); | ||
* | ||
* # It also supports the callback style. | ||
* // It also supports the callback style. | ||
* bar(0, (err, val) => { | ||
@@ -357,0 +357,0 @@ * console.log(val); // output => 1 |
/* | ||
Yaku v0.7.4 | ||
Yaku v0.7.5 | ||
(c) 2015 Yad Smood. http://ysmood.org | ||
@@ -141,3 +141,6 @@ License MIT | ||
// The parent Yaku. | ||
_pre: null | ||
_pre: null, | ||
// A unique type flag, it helps different versions of Yaku know each other. | ||
_Yaku: 1 | ||
}; | ||
@@ -159,6 +162,3 @@ | ||
Yaku.resolve = function (val) { | ||
if (val instanceof Yaku) | ||
return val; | ||
else | ||
return settleWithX(newEmptyYaku(), val); | ||
return isYaku(val) ? val : settleWithX(newEmptyYaku(), val); | ||
}; | ||
@@ -281,6 +281,6 @@ | ||
* | ||
* # The console will log an unhandled rejection error message. | ||
* // The console will log an unhandled rejection error message. | ||
* Promise.reject('my reason'); | ||
* | ||
* # The below won't log the unhandled rejection error message. | ||
* // The below won't log the unhandled rejection error message. | ||
* Promise.reject('v').catch(() => {}); | ||
@@ -497,2 +497,4 @@ * ``` | ||
function isYaku (val) { return val && val._Yaku; } | ||
/** | ||
@@ -691,3 +693,3 @@ * Create an empty promise. | ||
if (isFunction(xthen)) { | ||
if (isLongStackTrace && x instanceof Yaku) | ||
if (isLongStackTrace && isYaku(x)) | ||
p._next = x; | ||
@@ -694,0 +696,0 @@ |
{ | ||
"name": "yaku", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "An ES6 Promises/A+ implementation that doesn't hurt.", | ||
@@ -5,0 +5,0 @@ "main": "lib/yaku.js", |
@@ -20,3 +20,3 @@ <a href="http://promisesaplus.com/"> | ||
- The minified file is only 3.2KB (1.5KB gzipped) ([Bluebird][] / 73KB, [ES6-promise][] / 18KB) | ||
- The minified file is only 3.3KB (1.5KB gzipped) ([Bluebird][] / 73KB, [ES6-promise][] / 18KB) | ||
- [Better "possibly unhandled rejection" and "long stack trace"][docs/debugHelperComparison.md] than [Bluebird][] | ||
@@ -65,3 +65,3 @@ - Much better performance than the native Promise | ||
| -------------------- | -------------------- | --------------- | ------- | --------- | | ||
| Yaku | 257ms / 110MB | 126ms / 80MB | +++ | 3.2KB | | ||
| Yaku | 257ms / 110MB | 126ms / 80MB | +++ | 3.3KB | | ||
| [Bluebird][] v2.9 | 249ms / 102MB | 155ms / 80MB | +++++++ | 73KB | | ||
@@ -214,3 +214,3 @@ | [ES6-promise][] v2.3 | 427ms / 120MB | 92ms / 78MB | + | 18KB | | ||
- ### **[Yaku.resolve(value)](src/yaku.js?source#L152)** | ||
- ### **[Yaku.resolve(value)](src/yaku.js?source#L155)** | ||
@@ -333,6 +333,6 @@ The `Promise.resolve(value)` method returns a Promise object that is resolved with the given value. | ||
# The console will log an unhandled rejection error message. | ||
// The console will log an unhandled rejection error message. | ||
Promise.reject('my reason'); | ||
# The below won't log the unhandled rejection error message. | ||
// The below won't log the unhandled rejection error message. | ||
Promise.reject('v').catch(() => {}); | ||
@@ -385,3 +385,3 @@ ``` | ||
To use it you have to require it separately: `yutils = require 'yaku/lib/utils'`. | ||
To use it you have to require it separately: `var yutils = require("yaku/lib/utils")`. | ||
If you want to use it in the browser, you have to use `browserify` or `webpack`. | ||
@@ -521,3 +521,3 @@ | ||
var download = utils.flow(createUrl, curl, save); | ||
# same as "download = utils.flow([createUrl, curl, save])" | ||
// same as "download = utils.flow([createUrl, curl, save])" | ||
@@ -583,6 +583,6 @@ download('home'); | ||
bar(0).then((val) => { | ||
console.log val # output => 1 | ||
console.log val // output => 1 | ||
}); | ||
# It also supports the callback style. | ||
// It also supports the callback style. | ||
bar(0, (err, val) => { | ||
@@ -632,2 +632,4 @@ console.log(val); // output => 1 | ||
To use it you have to require it separately: `var ysource = require("yaku/lib/source")`. | ||
- ### **[source(executor)](src/source.js?source#L83)** | ||
@@ -634,0 +636,0 @@ |
60298
752