Comparing version 0.1.15 to 0.1.16
@@ -7,3 +7,3 @@ // aa.js - async-await.js | ||
var isPromise = PromiseThunk.isPromise; | ||
var wrap = PromiseThunk.wrap; | ||
var promisify = PromiseThunk.promisify; | ||
@@ -109,5 +109,5 @@ // GeneratorFunction | ||
// is function? then wrap it. | ||
// is function? then promisify it. | ||
if (typeof gtor === 'function') | ||
return wrap.call(ctx, gtor); | ||
return promisify.call(ctx, gtor); | ||
@@ -114,0 +114,0 @@ // is not generator? |
{ | ||
"name": "aa", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "aa - Async-Await. co like library, go like channel, thunkify or promisefy wrap package", | ||
"main": "aa.js", | ||
"dependencies": { | ||
"promise-thunk": ">=0.1.2" | ||
"promise-thunk": ">=0.1.3" | ||
}, | ||
@@ -9,0 +9,0 @@ "devDependencies": { |
@@ -37,2 +37,4 @@ [aa](https://www.npmjs.com/package/aa) - async await | ||
```bash | ||
$ node aa-readme-example.js | ||
or | ||
$ iojs aa-readme-example.js | ||
@@ -62,2 +64,3 @@ ``` | ||
} | ||
// var delay = aa.thunkify(sleep); | ||
@@ -69,5 +72,5 @@ delay(1100)( | ||
// aa(fn) | aa.wrap(fn) : returns wrapped function a.k.a thunkify and promisefy | ||
// wait(ms, args,...) : returns promise & thunk | ||
var wait = aa(sleep); | ||
// aa.promisify(fn) : returns wrapped function a.k.a thunkify and promisify | ||
// wait(ms, args,...) : returns promise & thunk | ||
var wait = aa.promisify(sleep); | ||
@@ -128,8 +131,8 @@ // wait() : as a thunk | ||
// make channel for sync - fork and join | ||
var chan = aa(); // or aa.chan() | ||
var chan = aa.chan(); | ||
sleep(300, 20, chan); // send value to channel | ||
sleep(200, 10, chan); // send value to channel | ||
var a = yield chan; // recv value from channel | ||
var b = yield chan; // recv value from channel | ||
sleep(300, 20, chan); // send value to channel : fork or spread | ||
sleep(200, 10, chan); // send value to channel : fork or spread | ||
var a = yield chan; // recv value from channel : join or sync | ||
var b = yield chan; // recv value from channel : join or sync | ||
console.log('10 20:', a, b); | ||
@@ -142,3 +145,3 @@ | ||
return 200; | ||
})(chan); // send 200 to channel | ||
})(chan); // send 200 to channel : join or sync | ||
@@ -149,3 +152,3 @@ // fork thread - make new thread and start | ||
return 100; | ||
})(chan); // send 100 to channel | ||
})(chan); // send 100 to channel : join or sync | ||
@@ -156,3 +159,3 @@ // fork thread - make new thread and start | ||
return 300; | ||
})(chan); // send 300 to channel | ||
})(chan); // send 300 to channel : join or sync | ||
@@ -167,3 +170,3 @@ // join threads - sync threads | ||
// communicate with channels | ||
var chan1 = aa(), chan2 = aa(); | ||
var chan1 = aa.chan(), chan2 = aa.chan(); | ||
@@ -170,0 +173,0 @@ // thread 1: send to chan1, recv from chan2 |
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
17242
222
Updatedpromise-thunk@>=0.1.3