Comparing version 0.0.6 to 0.0.7
{ | ||
"name":"qi", | ||
"description":"A small DSL for async flow control.", | ||
"version":"0.0.6", | ||
"version":"0.0.7", | ||
"homepage":"http://github.com/TorchlightSoftware/qi", | ||
@@ -6,0 +6,0 @@ "repository":"git://github.com/TorchlightSoftware/qi.git", |
@@ -19,2 +19,34 @@ # Qi | ||
# High Level Operators | ||
These are convenient functions for common use cases. | ||
## Map | ||
Map over arrays or objects, executing an asynchronous function. | ||
### Example | ||
```coffee-script | ||
should = require 'should' | ||
{map} = require 'qi' | ||
squareAsync = (n, next) -> | ||
next null, n * n | ||
describe 'map', -> | ||
it 'should process an array', (done) -> | ||
map [1, 2, 3], squareAsync, (err, results) -> | ||
results.should.eql [1, 4, 9] | ||
done() | ||
it 'should process an object', (done) -> | ||
map {a: 1, b: 2, c: 3}, squareAsync, (err, results) -> | ||
results.should.eql {a: 1, b: 4, c: 9} | ||
done() | ||
# Fundamental Operators | ||
These are the 3 base operators, from which all others are derived. | ||
## Focus | ||
@@ -26,2 +58,4 @@ | ||
You can pass a 'name' to the callback constructor to assign a name to a particular callback. If you do so, the results will become an object, with keys corresponding to the names you assigned. | ||
### Example | ||
@@ -107,2 +141,8 @@ | ||
# FAQ | ||
Q: Is focus safe to use on a mixture of synchronous and asynchronous subtasks? | ||
A: Yes. Subtasks return their results on process.nextTick, so as long as you construct all your callbacks synchronously, your results should not be collected prematurely. | ||
## LICENSE | ||
@@ -109,0 +149,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
12632
16
169