Registry / testing / function-queue

function-queue

JSON →
library0.0.12jsnpmunverified

FunctionQueue is a utility for executing functions in FIFO order, designed for Node.js (>=0.6). Version 0.0.12 is the latest release, which appears to be a stable but minimal package with no active development. It provides a simple queue mechanism where functions are added via `push()` and must call a provided callback to proceed to the next function. It lacks modern features like concurrency control, event support, or promise integration, making it a basic choice for sequential task execution compared to alternatives like `async.queue` or `bull`.

npm install function-queue
INSTALL
IMPORT
SIG · FUNCTION-QUEUE
F
function-queue
testingjavascriptv0.0.12
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.

FunctionQueue
import FunctionQueue from 'function-queue';
const FunctionQueue = require('function-queue');
Package has no documented default export; usage shows require('./src/function-queue.js')() - import may break.
default (factory function)
const FunctionQueue = require('function-queue')();
const FunctionQueue = require('function-queue');
Instantiates a queue by calling the required module as a function.
push
queue.push(fn);
queue.push(fn, callback);
push takes only one function argument; callback is passed to the function, not as a separate argument.

Creates a queue, adds two functions that execute in order. Each function must call callback to continue.

const FunctionQueue = require('function-queue')(); FunctionQueue.push(function(callback) { console.log('Task 1'); setTimeout(function() { console.log('Task 1 timeout'); callback(); }, 100); }); FunctionQueue.push(function(callback) { console.log('Task 2'); callback(); });
Debug
Known issues
gotchaYou must call the provided callback inside each function to progress the queue; otherwise the queue will hang permanently.
fix
Always invoke callback() when the function completes its asynchronous work.
affects: >=0.0.0
gotchaUsing require('function-queue') returns a factory function, not a queue instance. Forgetting the trailing () will result in trying to call push on a function.
fix
Always call the required module as a function: const queue = require('function-queue')();
affects: >=0.0.0
gotcharemoveAllObjects() only clears queued functions; already executing functions continue and must still call callback to complete.
fix
If you need to abort running tasks, implement your own cancellation logic.
affects: >=0.0.0
deprecatedThe package uses legacy patterns (no ESM, no promises) and has no updates since 2015.
fix
Consider migrating to async.queue, p-limit, or bull for modern queue management.
affects: 0.0.12
Errors
Common errors & fixes
TypeError: queue.push is not a function
Calling require('function-queue') without () returns a factory function, not a queue object.
fix
Use const queue = require('function-queue')();
Error: Callback was already called.
Callback was invoked more than once inside a queued function, breaking queue flow.
fix
Ensure callback() is called exactly once and not inside a loop or multiple branches.
RangeError: Maximum call stack size exceeded
Possibly due to recursive function calls without proper callbacks, causing infinite queue progression.
fix
Verify that callback is called after asynchronous operations complete, not synchronously in a loop.
Upgrade
Version history
0.0.12latest on npm
Audit
Dependencies
npmoptionalInstallation requires npm, though listed as a requirement.
Agent activity
4 hits · last 30 days
node
4
Resources
function-queue — npm install function-queue · libregistry