{"id":49029,"library":"queue-up","title":"queue-up","description":"Simple promise-based function queue for rate-limited execution. Version 2.1.0, stable, with low release cadence. Each enqueued function resolves after a configurable interval from the previous function's resolution. Supports initial value passing between chained functions. Lightweight, no dependencies. Unlike throttle/debounce, it queues calls to ensure spacing but never drops them.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/dsblv/queue-up","tags":["javascript","queue","enqueue","promise","then","rate","limited","interval","debounce"],"install":[{"cmd":"npm install queue-up","lang":"bash","label":"npm"},{"cmd":"yarn add queue-up","lang":"bash","label":"yarn"},{"cmd":"pnpm add queue-up","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses CommonJS; no default ESM export. In Node ≥12 with type:module, use createRequire or dynamic import. For TypeScript, use `import Queue = require('queue-up')`.","wrong":"import Queue from 'queue-up';","symbol":"Queue","correct":"const Queue = require('queue-up');"},{"note":"Pass a function reference or arrow function, not the result of calling the function. The queue expects a function to invoke later.","wrong":"queue.up(asyncFn());","symbol":"queue.up()","correct":"queue.up(() => asyncFn());"},{"note":"Takes an iterable (e.g., array) of functions. Returns promise resolving to array of results in order.","symbol":"queue.all()","correct":"queue.all([fn1, fn2]);"}],"quickstart":{"code":"const Queue = require('queue-up');\nconst delay = ms => new Promise(resolve => setTimeout(resolve, ms));\n\nasync function fetchUser(id) {\n  await delay(100);\n  return { id, name: `User${id}` };\n}\n\nconst queue = new Queue(200); // 200ms interval between functions\n\nqueue.up(() => fetchUser(1)).then(user => console.log('First:', user.name));\nqueue.up(() => fetchUser(2)).then(user => console.log('Second:', user.name));\n// First logs immediately, Second logs after ~200ms","lang":"javascript","description":"Creates a queue with 200ms interval and enqueues two async functions to demonstrate spacing."},"warnings":[{"fix":"Understand that long-running functions will cause subsequent functions to be delayed further. The total delay accumulates.","message":"The interval is measured from the resolution of the previous function to the invocation of the next, not from the start of execution.","severity":"gotcha","affected_versions":"all"},{"fix":"Always attach a .catch() to each queue.up() promise or handle errors inside the function.","message":"If the enqueued function throws or rejects, the queue continues; the error is propagated to the promise returned by queue.up() but does not stop the queue.","severity":"gotcha","affected_versions":"all"},{"fix":"Wrap the promise in an arrow function: queue.up(() => somePromise);","message":"queue.up() does not accept a promise; it must receive a function that returns a promise (or any value). Passing a promise directly will cause unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Use queue.up() instead of queue.enqueue().","message":"queue.enqueue() is an alias for queue.up() but may be removed in future versions.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.1.0':16 'base':7 'cadenc':21 'call':50 'chain':41 'configur':28 'debounc':66 'depend':45 'drop':56 'enqueu':23,60 'ensur':52 'execut':14 'function':8,24,33,42 'initi':37 'interv':29,65 'javascript':58 'lightweight':43 'limit':13,64 'low':19 'never':55 'pass':39 'previous':32 'promis':6,61 'promise-bas':5 'queue':2,9,49,59 'queue-up':1 'rate':12,63 'rate-limit':11 'releas':20 'resolut':35 'resolv':25 'simpl':4 'space':53 'stabl':17 'support':36 'throttle/debounce':47 'unlik':46 'valu':38 'version':15","created_at":"2026-06-07T16:59:40.956229+00:00","updated_at":"2026-06-07T16:59:40.956229+00:00","problems":[{"fix":"Use const Queue = require('queue-up'); and then const queue = new Queue();","cause":"Using default import style in Node.js or bundler expecting a default export, but the package exports a constructor as module.exports.","error":"TypeError: queue.up is not a function"},{"fix":"Attach a catch handler: queue.up(fn).catch(err => console.error(err));","cause":"A function enqueued via queue.up() threw an error and the returned promise was not caught.","error":"UnhandledPromiseRejectionWarning: Error: something failed"},{"fix":"Ensure you pass a function reference or arrow function: queue.up(() => myAsyncFunction());","cause":"Passing a non-function value (e.g., a promise or a result) to queue.up().","error":"Error: fn is not a function"}],"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/dsblv/queue-up#readme","github":"https://github.com/dsblv/queue-up","docs":null,"changelog":null,"pypi":null,"npm":"queue-up","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"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}}