Registry / testing / qew
library0.11.1jsnpmunverified

A tiny, zero-dependency library for queuing and throttling asynchronous JavaScript/TypeScript functions. Current stable version is 0.11.1, released with monthly cadence. Key differentiators: no runtime dependencies, minimal API surface, supports configurable max concurrency and delay between function executions, ships TypeScript types, works in both Node.js and browser environments.

npm install qew
INSTALL
IMPORT
SIG · QEW
Q
qew
testingjavascriptv0.11.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.

Qew
✓ import { Qew } from 'qew'
✗ import Qew from 'qew'
The package exports a named class; default import is not supported.
Qew
✓ const { Qew } = require('qew')
✗ const Qew = require('qew')
CommonJS users must destructure the named export; direct assignment assigns the module object.
Qew instance
✓ const q = new Qew(2, 500)
✗ const q = Qew(2, 500)
Qew must be instantiated with 'new'; calling without 'new' will not work.
TypeScript types
✓ import { Qew } from 'qew'
Types are included; no separate @types/qew needed.

Demonstrates instantiation, task pushing, and promise resolution with a queue throttling 2 concurrent requests with 100ms delay.

import { Qew } from 'qew'; // Create a queue with max concurrency 2 and 100ms delay between tasks const queue = new Qew(2, 100); async function fetchData(url: string): Promise<string> { const response = await fetch(url); return response.text(); } // Queue multiple async tasks queue.push(() => fetchData('https://api.example.com/1')).then(console.log); queue.push(() => fetchData('https://api.example.com/2')).then(console.log); queue.push(() => fetchData('https://api.example.com/3')).then(console.log); // Using async/await async function main() { const result = await queue.push(() => fetchData('https://api.example.com/4')); console.log(result); }
Debug
Known issues
gotchaConstructor arguments are positional: new Qew(maxConcurrency, delay). It's easy to swap them accidentally.
fix
Use named arguments or check order: new Qew(concurrency, delay).
affects: >=0.0.0
gotchaQew.push expects a function that returns a Promise. Passing an async function that throws synchronously will cause unhandled rejections.
fix
Ensure the function always returns a promise, e.g., wrap sync code in async function or use Promise.resolve().
affects: >=0.0.0
gotchaThe delay parameter as a function is invoked on each task start. If the function returns a negative number, behavior is undefined.
fix
Always return a non-negative number from the delay function.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Qew is not a constructor
Attempting to call Qew without new or incorrect import style.
fix
Use new Qew(...) after importing correctly: import { Qew } from 'qew' or const { Qew } = require('qew').
Cannot find module 'qew' or its corresponding type declarations.
Missing package installation or bundler configuration not recognizing package exports.
fix
Run 'npm install qew' and ensure your tsconfig.json includes moduleResolution: node or node16.
Upgrade
Version history
0.11.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
packageqew ↗
qew — npm install qew · libregistry