Registry / devops / miniq
library1.0.1jsnpmunverified

miniq is a tiny async control flow library for Node.js (v1.0.1) that implements parallelLimit with a concurrency-limited queue. It supports series, parallel, and limited-concurrency patterns by varying the limit parameter (1, Infinity, or a number). Its unique feature allows sharing a single concurrency-limited queue across multiple sets of tasks, each with its own completion callback. The library uses setImmediate to prevent stack overflows, configurable via maxStack property. It focuses on minimalism and avoids result-passing variants, relying on JavaScript scope. Compatible with Node 10.x and above.

npm install miniq
INSTALL
IMPORT
SIG · MINIQ
M
miniq
devopsjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parallel
const parallel = require('miniq');
import { parallel } from 'miniq';
miniq is CJS-only; no ESM exports. Use require().
queue object
const queue = parallel(limit, tasks, onDone); queue.exec(moreTasks, onDone);
const queue = new parallel.Queue(limit);
The function returns a queue object with exec, isEmpty, isFull methods.
setImmediate workaround
queue.maxStack = Infinity;
parallel.setMaxStack(50);
maxStack is a property on the returned queue object, not a function.

Shows how to use parallel() with concurrency limit of 2, tasks call done(), and onDone callback after all tasks finish.

const parallel = require('miniq'); // Simple parallel with concurrency limit let results = []; parallel(2, [ function(done) { setTimeout(() => { results.push(1); done(); }, 100); }, function(done) { setTimeout(() => { results.push(2); done(); }, 50); }, function(done) { setTimeout(() => { results.push(3); done(); }, 10); } ], function(err) { if (err) console.error(err); else console.log('Done. Results:', results); // Order: 2, 1, 3 (or similar, limited to 2 concurrent) });
Debug
Known issues
deprecatedremoveTasks() and concurrency() methods are deprecated since v1.0.0
fix
Use exec() to add tasks; concurrency is set only via the limit parameter on initial call.
affects: >=1.0.0
gotchaEmpty tasks array in v1.0.0 does not emit 'empty' (fixed in 1.0.1)
fix
Upgrade to v1.0.1 or ensure tasks array is non-empty.
affects: >=1.0.0 <1.0.1
gotchamaxStack default is 50; may cause performance overhead for fully async workloads
fix
Set queue.maxStack = Infinity if all tasks are already asynchronous.
affects: >=0.1.0
gotchaminiq does not pass results between tasks, only error to done callback
fix
Capture results in shared variables via closures instead.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: parallel is not a function
Attempting to use ES6 import syntax with a CJS module.
fix
Use const parallel = require('miniq');
ReferenceError: setImmediate is not defined
Running in an environment (e.g., older Node or browser) without setImmediate.
fix
Use polyfill or set queue.maxStack = Infinity to bypass setImmediate.
Error: done is not a function
The task callback is not calling the passed 'done' function correctly.
fix
Ensure each task function receives (done) and calls done() or done(err) upon completion.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
packageminiq
miniq — npm install miniq · libregistry