{"id":49424,"library":"std-queue","title":"std-queue","description":"std-queue is an efficient FIFO queue for JavaScript/TypeScript that provides O(1) enqueue and dequeue operations. Version 0.1.6 is the latest stable release. Its key differentiator is an underlying linked list of subqueues (arrays of max size 1000) that avoids the O(n) shift cost of naive array-based queues and the memory overhead of pure linked lists. Designed for handling large amounts of data efficiently. The package ships TypeScript type definitions and has no external dependencies. It is actively maintained on GitHub.","status":"active","version":"0.1.6","language":"javascript","source_language":"en","source_url":"https://github.com/coyotte508/std-queue","tags":["javascript","queue","fifo","efficient","fast","typescript"],"install":[{"cmd":"npm install std-queue","lang":"bash","label":"npm"},{"cmd":"yarn add std-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add std-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only; named import will return undefined.","wrong":"import { Queue } from 'std-queue'","symbol":"Queue","correct":"import Queue from 'std-queue'"},{"note":"CommonJS require returns the default export directly.","wrong":"const { Queue } = require('std-queue')","symbol":"Queue","correct":"const Queue = require('std-queue')"},{"note":"TypeScript types are bundled but there is no named type export; use InstanceType or typeof pattern.","wrong":"import type { Queue } from 'std-queue'","symbol":"Queue (type)","correct":"import Queue from 'std-queue'; type QueueType = InstanceType<typeof Queue>"}],"quickstart":{"code":"import Queue from 'std-queue';\n\nconst queue = new Queue();\n\nqueue.push(1);\nqueue.push(2);\n\nfor (let i = 10; i < 10000; i++) {\n  queue.push(i);\n}\n\nqueue.push('Hello', 'World');\n\nconsole.log(queue.peek()); // 1\nconsole.log(queue.last()); // 'World'\nconsole.log(queue.shift()); // 1\nconsole.log(queue.length); // 9993\n\nqueue.clear();\nconsole.log(queue.shift()); // undefined","lang":"typescript","description":"Demonstrates creating a queue, adding elements in bulk with push(), peeking front and back, dequeuing with shift(), checking length, and clearing the queue."},"warnings":[{"fix":"Iterate manually: while (queue.length) { process(queue.shift()); }","message":"Queue instances do not have Array-like iteration (e.g., for...of). Use shift() or clear() to process all elements.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use standard array methods after converting to an array if needed.","message":"The queue does not support negative indices or slicing; only peek(), last(), shift(), and clear() are available for access.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check queue.length before calling shift() if undefined is unacceptable.","message":"shift() returns undefined when queue is empty, not throw an error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"const arr = []; while (queue.length) arr.push(queue.shift());","message":"The queue does not have a built-in toArray() method; you must manually drain the queue to collect elements.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.1.6':23 '1':17 '1000':43 'activ':86 'amount':69 'array':39,54 'array-bas':53 'avoid':45 'base':55 'cost':50 'data':71 'definit':78 'depend':83 'dequeu':20 'design':65 'differenti':31 'effici':9,72,93 'enqueu':18 'extern':82 'fast':94 'fifo':10,92 'github':89 'handl':67 'javascript':90 'javascript/typescript':13 'key':30 'larg':68 'latest':26 'link':35,63 'list':36,64 'maintain':87 'max':41 'memori':59 'n':48 'naiv':52 'o':16,47 'oper':21 'overhead':60 'packag':74 'provid':15 'pure':62 'queue':3,6,11,56,91 'releas':28 'shift':49 'ship':75 'size':42 'stabl':27 'std':2,5 'std-queue':1,4 'subqueu':38 'type':77 'typescript':76,95 'under':34 'version':22","created_at":"2026-06-07T17:01:43.040863+00:00","updated_at":"2026-06-07T17:01:43.040863+00:00","problems":[{"fix":"Check queue.length before calling shift() or ensure queue is not empty.","cause":"Attempting to access an element from an empty queue (e.g., shift() returns undefined, but code expects an actual value).","error":"TypeError: Cannot read properties of undefined (reading '0')"},{"fix":"Use default import: `import Queue from 'std-queue'`.","cause":"Using named import `import { Queue } from 'std-queue'` instead of default import.","error":"Property 'Queue' does not exist on type 'typeof import(\"std-queue\")'"},{"fix":"Use import syntax: `import Queue from 'std-queue'`.","cause":"Using require() in an ES module (type: module or .mjs file).","error":"Require is not defined in ES module scope"}],"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/coyotte508/std-queue#readme","github":"https://github.com/coyotte508/std-queue","docs":null,"changelog":null,"pypi":null,"npm":"std-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"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}}