
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Pool works as queue or stack.
Queue-Pool Is pool of elements, implements major Array methods. With ability to auto-adjust length.
If you handle a group of incoming streams of chunks, process them in a pool, there is a need to release them in stack or queue order.
npm install queue-pool
import QPool from "queue-pool";
const qpool = new QPool(options);
options
init for custom initialize, instead of empty string as default.maxIn a number, for max size allowed in pool. Default is 2.Methods
get
length
elementsSize an array contains size of each element in the pool.
elementsLength a number of elements in.
flush
unshift
push
shift
pop
process push and adjust the size.
process(input, type, cb)
type: stack or queue. Default is queue.
cb(get): optional.
In case you made several
pushcalls passing the allowed number set inmaxIn. It autoshiftin case of queue/popin case of stack over elements and thenpushthe new one. Using this method you guarantee that you are not passing the number of elements you set.
const qpool = new QPool();
qpool.push("pigs, "); // pigs,
qpool.push("goats, "); // pigs, goats,
qpool.push("sheep."); // pigs, goats, sheep.
qpool.shift(); // goats, sheep.
qpool.pop(); // goats,
qpool.unshift("sheep, "); // sheep, goats,
qpool.elementsLength(); // 2
qpool.elementsSize(); // [7 , 7]
qpool.length(); // 14
const qpool = new QPool({ maxIn: 5 });
for (let i = 0; i < 10; i++) qpool.push(`${i} `);
qpool.get(); // 0 1 2 3 4 5 6 7 8 9
qpool.process("last-element");
qpool.get(); // 6 7 8 9 last-element
const qpool = new QPool({ maxIn: 5 });
for (let i = 0; i < 10; i++) qpool.push(`${i} `);
qpool.get(); // 0 1 2 3 4 5 6 7 8 9
qpool.process("last-element", "stack", (get) => {
console.log(get); // 0, 1, 2, 3 last-element
});
test
This project is licensed under the MIT License
FAQs
> Pool works as queue or stack.
We found that queue-pool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.