{"_id":"miniq","_rev":"164332","name":"miniq","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"time":{"modified":"2021-06-03T11:43:50.000Z","created":"2014-02-11T21:55:31.569Z","1.0.1":"2016-09-07T06:41:06.387Z","1.0.0":"2014-11-15T04:44:02.061Z","0.1.2":"2014-06-23T22:49:36.870Z","0.1.1":"2014-06-09T20:28:52.762Z","0.1.0":"2014-06-09T05:26:00.656Z","0.0.2":"2014-06-09T01:21:27.978Z","0.0.1":"2014-02-11T21:55:31.569Z"},"users":{},"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"versions":{"1.0.1":{"name":"miniq","version":"1.0.1","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"0.0.6","ondone":"~1.0.0"},"devDependencies":{"gluejs":"~2.4.0"},"scripts":{"test":"mocha -R spec test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"gitHead":"8c148bf8e668a76807114c14fc657967590cdb70","homepage":"https://github.com/mixu/miniq#readme","_id":"miniq@1.0.1","_shasum":"855ed29ad319456f08785a1b4f06bbbdd9a4f2c1","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"dist":{"shasum":"855ed29ad319456f08785a1b4f06bbbdd9a4f2c1","size":4536,"noattachment":false,"key":"/miniq/-/miniq-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-1.0.1.tgz"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/miniq-1.0.1.tgz_1473230466165_0.38555814512073994"},"publish_time":1473230466387,"_cnpm_publish_time":1473230466387,"_hasShrinkwrap":false},"1.0.0":{"name":"miniq","version":"1.0.0","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"~0.0.6","ondone":"~1.0.0"},"devDependencies":{"gluejs":"~2.3.2"},"scripts":{"test":"mocha -R spec test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"gitHead":"bb17723cfc38a666a3087ea568c8aea95cce5546","homepage":"https://github.com/mixu/miniq","_id":"miniq@1.0.0","_shasum":"a084400ea6d669141b75c6f1f76786ff677486f6","_from":".","_npmVersion":"2.1.5","_nodeVersion":"0.10.32","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"dist":{"shasum":"a084400ea6d669141b75c6f1f76786ff677486f6","size":4505,"noattachment":false,"key":"/miniq/-/miniq-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-1.0.0.tgz"},"publish_time":1416026642061,"_cnpm_publish_time":1416026642061,"_hasShrinkwrap":false},"0.1.2":{"name":"miniq","version":"0.1.2","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"~0.0.5"},"devDependencies":{"gluejs":"~2.3.2"},"scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"_id":"miniq@0.1.2","dist":{"shasum":"4d47be3e226da6f0eb383b4d980517bbca4a842f","size":4851,"noattachment":false,"key":"/miniq/-/miniq-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-0.1.2.tgz"},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"publish_time":1403563776870,"_cnpm_publish_time":1403563776870,"_hasShrinkwrap":false},"0.1.1":{"name":"miniq","version":"0.1.1","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"~0.0.5"},"devDependencies":{"gluejs":"~2.3.2"},"scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"homepage":"https://github.com/mixu/miniq","_id":"miniq@0.1.1","_shasum":"f9dcdb4943d3a7946d480bc45433040d64cbc42b","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"dist":{"shasum":"f9dcdb4943d3a7946d480bc45433040d64cbc42b","size":4827,"noattachment":false,"key":"/miniq/-/miniq-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-0.1.1.tgz"},"publish_time":1402345732762,"_cnpm_publish_time":1402345732762,"_hasShrinkwrap":false},"0.1.0":{"name":"miniq","version":"0.1.0","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"~0.0.5"},"devDependencies":{"gluejs":"~2.3.2"},"scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"homepage":"https://github.com/mixu/miniq","_id":"miniq@0.1.0","_shasum":"71c828f7de36c38909f6b7bfd97242a0af993075","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"dist":{"shasum":"71c828f7de36c38909f6b7bfd97242a0af993075","size":4615,"noattachment":false,"key":"/miniq/-/miniq-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-0.1.0.tgz"},"publish_time":1402291560656,"_cnpm_publish_time":1402291560656,"_hasShrinkwrap":false},"0.0.2":{"name":"miniq","version":"0.0.2","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"~0.0.5"},"devDependencies":{"gluejs":"~2.3.2"},"scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"_id":"miniq@0.0.2","dist":{"shasum":"853f08656ea545e67df753e5f5bad32c9114c04e","size":4065,"noattachment":false,"key":"/miniq/-/miniq-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"publish_time":1402276887978,"_cnpm_publish_time":1402276887978,"_hasShrinkwrap":false},"0.0.1":{"name":"miniq","version":"0.0.1","description":"Yet another tiny async control flow library, implements parallelLimit, with the ability to share the concurrency-limited queue.","main":"index.js","directories":{"test":"test"},"dependencies":{"microee":"~0.0.5"},"devDependencies":{"gluejs":"~2.3.2"},"scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git://github.com/mixu/miniq.git"},"keywords":["queue","async","asynchronous","flow","control"],"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","bugs":{"url":"https://github.com/mixu/miniq/issues"},"_id":"miniq@0.0.1","dist":{"shasum":"e171e81f2572169a28090ecf0d0c0be970cd7193","size":3827,"noattachment":false,"key":"/miniq/-/miniq-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniq/download/miniq-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.31","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"publish_time":1392155731569,"_cnpm_publish_time":1392155731569,"_hasShrinkwrap":false}},"readme":"# miniq\n\nminiq is yet another tiny async control flow library. It implements parallelLimit, with the ability to share the concurrency-limited queue.\n\n## Changelog\n\n`v1.0.1`: when given an empty tasks array, `empty` was not emitted.\n\n`v1.0.0`: reduced the overall size by using [`ondone`](https://github.com/mixu/ondone) for the \"wait to complete\" functionality. Deprecated the `removeTasks()` and `concurrency()` methods. Added the `isFull` and `isEmpty` methods.\n\n## Features\n\n- small: miniq only implements `parallelLimit`\n- can be used for all three basic control flow patterns\n  - `series` = `parallel(1, tasks, onDone)`\n  - `parallel` without a concurrency limit = `parallel(Infinity, tasks, onDone)`\n  - `parallel` with a concurrency = default behavior\n- no result passing: Many control flow libraries have a dozen variants which simply pass the result around in slightly different ways (e.g. `chain` vs. `map`). I'd rather just use JavaScript's scope rules to handle all those variants rather than have specialized functions for each thing.\n- Node 10.x compatibility\n\nminiq has one advanced feature, which is the ability to share the concurrency-limited queue among multiple different tasks. In other words, many different sets of operations can share the same queue and run limit. Each set of tasks can have it's own `onDone` function, but they share the same concurrency limit.\n\nFor example, if you are writing something that does a recursive directory traversal and does various (file system) operations, you can push all the operations into the same queue. This will allow you to limit (file system) concurrency across multiple operations.\n\n## Installation\n\n    npm install --save miniq\n\n## API\n\n`parallel(limit, tasks, [onDone])`:\n\n- `limit` is a number which controls the maximum number of concurrent tasks. Set `limit = 1` for serial execution and `limit = Infinity` for unlimited parallelism.\n- `onDone` is a callback `function(err) { ... }`; it is called when the tasks it is associated with have run\n- `tasks` are callbacks `function(done) { ... }` which should call `done()` when they are complete.\n\nThe return value is an object with the following API:\n\n- `.exec(tasks, [onDone])`: appends the new set of tasks and queues the `onDone` function once all of those tasks have completed.\n- `isEmpty`: returns true if the queue is empty.\n- `isFull`: returns true if the queue is currently running the maximum number of tasks.\n\n## Some notes on Node 0.10.x (supported since `0.1.x`)\n\n`miniq` uses `setImmediate` when available to break call stacks.\n\nThis is done by default in order to prevent stack overflows from occurring when executing in a tight loop. However, if your workload is already asynchronous, then you will never run into a call stack overflow since async calls break up the call stack.\n\nThe `.maxStack` property on the queue controls when a `setImmediate` / `nextTick` call is inserted. It is set to `50` by default, which seems to retain a good balance between call stack size and avoiding scheduling overhead.\n\n You should disable `maxStack` by setting it to `Infinity` if you know in advance that the work payloads are async and hence you will not need to occasionally break out of the call stack.\n\nTo set the `maxStack`, set it on the return value. For example:\n\n    var queue = parallel(10, [ ... ], onDone);\n    queue.maxStack = Infinity;\n\nFor maximum performance when operations are cheap (e.g. stat calls), set the queue `limit` to `Infinity` and the `maxStack` property to `Infinity`. This skips a lot of management overhead as all tasks are launched immediately and no stack breaks are inserted.\n\n## Example: replacement for `parallelLimit`\n\n    var parallel = require('miniq');\n\n    parallel(10, [\n      function(done) {\n        fs.readFile(function(err, result) {\n          if(err) {\n            return done(err); // done takes one argument: the error\n          }\n        }\n      },\n    ], function(err) {\n      // err is sent if any of the tasks returned an error\n    });\n\n\n## Example: replacement for `parallel`\n\n    var parallel = require('miniq');\n\n    parallel(Infinity, [\n      function(done) { ... },\n    ], function(err) {\n      // err is sent if any of the tasks returned an error\n    });\n\n## Example: replacement for `series`\n\n    var parallel = require('miniq');\n\n    parallel(1, [\n      function(done) { ... },\n    ], function(err) {\n      // err is sent if any of the tasks returned an error\n    });\n\n## Example: using miniq as a shared maximum-concurrency limited queue\n\n    var parallel = require('miniq');\n\n    function Foo() {\n      this.queue = parallel(12);\n    }\n\n    Foo.prototype.bar = function() {\n      this.queue.exec(tasks, function(err) { ... });\n    };\n\n    Foo.prototype.all = function() {\n      // when the queue is empty\n      this.queue.once('empty', function() {\n        console.log('All done!');\n      });\n\n      this.queue.exec(tasks);\n    };\n","_attachments":{},"homepage":"https://github.com/mixu/miniq#readme","bugs":{"url":"https://github.com/mixu/miniq/issues"},"license":"BSD"}