Registry / testing / async-queue-chain

async-queue-chain

JSON →
library1.1.0jsnpmunverified

A tiny utility (1.1.0) to chain async functions in a queue and run them sequentially. Released as ESM/CJS with TypeScript types. Unlike general-purpose async queues (e.g., p-limit, Bottleneck), this package focuses on a chainable API, automatic sequential execution, and value passing between tasks. Ideal for managing event-driven workflows where tasks must not overlap. Maintained on GitHub with minimal dependencies.

npm install async-queue-chain
INSTALL
IMPORT
SIG · ASYNC-QUEUE-CHAIN
A
async-queue-chain
testingjavascriptv1.1.0
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.

createAsyncQueue
import { createAsyncQueue } from 'async-queue-chain'
const createAsyncQueue = require('async-queue-chain')
Package is ESM-first; CommonJS require() may work but is not recommended. TypeScript declarations included.
default import
import createAsyncQueue from 'async-queue-chain'
import * as createAsyncQueue from 'async-queue-chain'
Default export is deprecated since v1.1.0; use named import instead.
AsyncQueueChain type
import type { AsyncQueueChain } from 'async-queue-chain'
import { AsyncQueueChain } from 'async-queue-chain'
AsyncQueueChain is a type-only export; do not use as runtime value.

Creates an async queue, adds two tasks that pass values, and runs sequentially.

import { createAsyncQueue } from 'async-queue-chain'; const queue = createAsyncQueue(); queue.add(async () => { console.log('Task 1'); return 1; }); queue.add(async (prev) => { console.log('Task 2 received:', prev); return prev + 1; }); const result = await queue.run(0); console.log('Final result:', result); // 2
Debug
Known issues
deprecatedDefault import is deprecated in v1.1.0
fix
Use named import { createAsyncQueue } instead.
affects: >=1.1.0
gotcharun() without initial value will pass undefined to the first task if later tasks expect a value
fix
Provide an initial value to run() when tasks chain values: await queue.run(initialValue)
affects: >=0.0.0
gotcharun() calls are no-ops if the queue is already running – tasks can be lost if not awaited
fix
Ensure you await run() or handle the promise to avoid silent drops.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: createAsyncQueue is not a function
Using default import on v1.1.0+ where named export is required
fix
Change to import { createAsyncQueue } from 'async-queue-chain'
Error: Cannot find module 'async-queue-chain'
Package not installed or using incorrect import path
fix
Run npm install async-queue-chain and verify import path
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
38
Amazon
1
OpenAI (training)
1
Resources
async-queue-chain — npm install async-queue-chain · libregistry