Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "contra", | ||
"description": "Asynchronous flow control with a functional taste to it", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"homepage": "https://github.com/bevacqua/contra", | ||
@@ -6,0 +6,0 @@ "author": { |
# 1.3.0 | ||
- Concurrent methods now use a queue internally | ||
- `λ.concurrent` has an optional concurrency cap argument | ||
- Series now use a concurrent queue internally, with `concurrency = 1` | ||
Fixes | ||
- Fixed a bug where queues weren't working concurrently | ||
- Fixed an issue where queues would emit `drain` while processing jobs | ||
# 1.2.2 | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "contra", | ||
"description": "Asynchronous flow control with a functional taste to it", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"homepage": "https://github.com/bevacqua/contra", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -24,3 +24,3 @@ ![contra.png][logo] | ||
- [`λ.series`](#%CE%BBseriestasks-done) | ||
- [`λ.concurrent`](#%CE%BBconcurrenttasks-done) | ||
- [`λ.concurrent`](#%CE%BBconcurrenttasks-concurrency-done) | ||
@@ -73,3 +73,3 @@ Functional | ||
## `λ.waterfall(tasks[, done])` | ||
## `λ.waterfall(tasks, done?)` | ||
@@ -97,4 +97,6 @@ Executes tasks in series. Each step receives the arguments from the previous step. | ||
## `λ.series(tasks[, done])` | ||
## `λ.series(tasks, done?)` | ||
**Effectively an alias for `λ.concurrent(tasks, 1, done)`.** | ||
Executes tasks in series. `done` gets all the results. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. | ||
@@ -139,7 +141,8 @@ | ||
## `λ.concurrent(tasks[, done])` | ||
## `λ.concurrent(tasks, concurrency?, done?)` | ||
Executes tasks concurrently. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. | ||
Executes tasks concurrently. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. You can set a concurrency cap, and it's uncapped by default. | ||
- `tasks` Collection of functions with the `(cb)` signature. Can be an array or an object | ||
- `concurrency` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-concurrency1) | ||
- `done` Optional function with the `(err, results)` signature | ||
@@ -181,3 +184,3 @@ | ||
## `λ.each(items, iterator[, done])` | ||
## `λ.each(items, iterator, done?)` | ||
@@ -203,7 +206,7 @@ Applies an iterator to each element in the collection concurrently. | ||
## `λ.each.series(items, iterator[, done])` | ||
## `λ.each.series(items, iterator, done?)` | ||
Same as `λ.each(items, iterator[, done])`, but in series instead of concurrently. | ||
Same as `λ.each(items, iterator, done?)`, but in series instead of concurrently. | ||
## `λ.map(items, iterator[, done])` | ||
## `λ.map(items, iterator, done?)` | ||
@@ -229,7 +232,7 @@ Applies an iterator to each element in the collection concurrently. Produces an object with the transformation results. Task order is preserved in the results. | ||
## `λ.map.series(items, iterator[, done])` | ||
## `λ.map.series(items, iterator, done?)` | ||
Same as `λ.map(items, iterator[, done])`, but in series instead of concurrently. | ||
Same as `λ.map(items, iterator, done?)`, but in series instead of concurrently. | ||
## `λ.filter(items, iterator[, done])` | ||
## `λ.filter(items, iterator, done?)` | ||
@@ -257,7 +260,7 @@ Applies an iterator to each element in the collection concurrently. Produces an object with the filtered results. Task order is preserved in results. | ||
## `λ.filter.series(items, iterator[, done])` | ||
## `λ.filter.series(items, iterator, done?)` | ||
Same as `λ.filter(items, iterator[, done])`, but in series instead of concurrently. | ||
Same as `λ.filter(items, iterator, done?)`, but in series instead of concurrently. | ||
## `λ.queue(worker[, concurrency=1])` | ||
## `λ.queue(worker, concurrency=1)` | ||
@@ -273,4 +276,4 @@ Used to create a job queue. | ||
- `push(job[, done])` Array of jobs or an individual job object. Enqueue those jobs, continue processing **(unless paused)**. Optional callback to run when each job is completed | ||
- `unshift(job[, done])` Array of jobs or an individual job object. Add jobs to the top of the queue, continue processing **(unless paused)**. Optional callback to run when each job is completed | ||
- `push(job, done?)` Array of jobs or an individual job object. Enqueue those jobs, continue processing **(unless paused)**. Optional callback to run when each job is completed | ||
- `unshift(job, done?)` Array of jobs or an individual job object. Add jobs to the top of the queue, continue processing **(unless paused)**. Optional callback to run when each job is completed | ||
- `pending` Property. Jobs that haven't started processing yet | ||
@@ -280,3 +283,3 @@ - `length` Short-hand for `pending.length`, only works if getters can be defined | ||
- `resume()` Start processing jobs again, after a `pause()` | ||
- `on('drain', fn)` Execute `fn` whenever there's no more pending jobs and processing is requested. Processing can be requested using `resume`, `push`, or `unshift` | ||
- `on('drain', fn)` Execute `fn` whenever there's no more pending _(or running)_ jobs and processing is requested. Processing can be requested using `resume`, `push`, or `unshift` | ||
@@ -305,5 +308,5 @@ ```js | ||
// <- 'job' | ||
// <- 'some' | ||
// <- 'more' | ||
// <- 'this job is done!' | ||
// <- 'one of these jobs is done!' | ||
// <- 'one of these jobs is done!' | ||
// <- 'all done!' | ||
@@ -387,5 +390,6 @@ ``` | ||
`parallel`|`concurrent` | ||
`parallelLimit`|`concurrent` | ||
`mapSeries`|`map.series` | ||
More _comprehensive_|More _focused_ | ||
`~29.6k (minified, uncompressed)`|`~2.8k (minified, uncompressed)` | ||
`~29.6k (minified, uncompressed)`|`~2.7k (minified, uncompressed)` | ||
@@ -392,0 +396,0 @@ `λ` isn't meant to be a replacement for `async`. It aims to provide a more focused library, and a bit more consistency. |
@@ -520,3 +520,3 @@ 'use strict'; | ||
it('should report errors', function (done) { | ||
it('should forward errors', function (done) { | ||
var ww; | ||
@@ -523,0 +523,0 @@ function w (job, done) { |
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
56251
422