{"id":45955,"library":"qew","title":"Qew","description":"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.","status":"active","version":"0.11.1","language":"javascript","source_language":"en","source_url":"https://github.com/Arrow7000/qew","tags":["javascript","queue","async","throttle","promise","typescript"],"install":[{"cmd":"npm install qew","lang":"bash","label":"npm"},{"cmd":"yarn add qew","lang":"bash","label":"yarn"},{"cmd":"pnpm add qew","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a named class; default import is not supported.","wrong":"import Qew from 'qew'","symbol":"Qew","correct":"import { Qew } from 'qew'"},{"note":"CommonJS users must destructure the named export; direct assignment assigns the module object.","wrong":"const Qew = require('qew')","symbol":"Qew","correct":"const { Qew } = require('qew')"},{"note":"Qew must be instantiated with 'new'; calling without 'new' will not work.","wrong":"const q = Qew(2, 500)","symbol":"Qew instance","correct":"const q = new Qew(2, 500)"},{"note":"Types are included; no separate @types/qew needed.","wrong":null,"symbol":"TypeScript types","correct":"import { Qew } from 'qew'"}],"quickstart":{"code":"import { Qew } from 'qew';\n\n// Create a queue with max concurrency 2 and 100ms delay between tasks\nconst queue = new Qew(2, 100);\n\nasync function fetchData(url: string): Promise<string> {\n  const response = await fetch(url);\n  return response.text();\n}\n\n// Queue multiple async tasks\nqueue.push(() => fetchData('https://api.example.com/1')).then(console.log);\nqueue.push(() => fetchData('https://api.example.com/2')).then(console.log);\nqueue.push(() => fetchData('https://api.example.com/3')).then(console.log);\n\n// Using async/await\nasync function main() {\n  const result = await queue.push(() => fetchData('https://api.example.com/4'));\n  console.log(result);\n}","lang":"typescript","description":"Demonstrates instantiation, task pushing, and promise resolution with a queue throttling 2 concurrent requests with 100ms delay."},"warnings":[{"fix":"Use named arguments or check order: new Qew(concurrency, delay).","message":"Constructor arguments are positional: new Qew(maxConcurrency, delay). It's easy to swap them accidentally.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure the function always returns a promise, e.g., wrap sync code in async function or use Promise.resolve().","message":"Qew.push expects a function that returns a Promise. Passing an async function that throws synchronously will cause unhandled rejections.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always return a non-negative number from the delay function.","message":"The delay parameter as a function is invoked on each task start. If the function returns a negative number, behavior is undefined.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.11.1':19 'api':30 'async':53 'asynchron':12 'browser':49 'cadenc':23 'concurr':35 'configur':33 'current':15 'delay':37 'depend':6,28 'differenti':25 'environ':50 'execut':40 'function':14,39 'javascript':51 'javascript/typescript':13 'key':24 'librari':7 'max':34 'minim':29 'month':22 'node.js':47 'promis':55 'qew':1 'queu':9 'queue':52 'releas':20 'runtim':27 'ship':41 'stabl':16 'support':32 'surfac':31 'throttl':11,54 'tini':3 'type':43 'typescript':42,56 'version':17 'work':44 'zero':5 'zero-depend':4","created_at":"2026-06-07T12:57:33.053277+00:00","updated_at":"2026-06-07T12:57:33.053277+00:00","problems":[{"fix":"Use new Qew(...) after importing correctly: import { Qew } from 'qew' or const { Qew } = require('qew').","cause":"Attempting to call Qew without new or incorrect import style.","error":"TypeError: Qew is not a constructor"},{"fix":"Run 'npm install qew' and ensure your tsconfig.json includes moduleResolution: node or node16.","cause":"Missing package installation or bundler configuration not recognizing package exports.","error":"Cannot find module 'qew' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Arrow7000/qew#readme","github":"https://github.com/Arrow7000/qew","docs":null,"changelog":null,"pypi":null,"npm":"qew","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}