
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.
Simple & super fast object pool for javascript
To create a new pool you just need to provide a constructor function to the exported class.
You constructor function must have a prototype function called reset, which will be called upon release.
To get a new object, just call pool.get(). To add an object to the pool call pool.release(obj);.
import Pool from 'opool';
class MyClass {
constructor() {
MyClass.reset(this);
}
static reset(obj: MyClass) {
obj.something = null;
}
}
export default const pool = new Pool(MyClass);
// Then somewhere else...
const obj1 = pool.get(); // returns new MyClass
const obj2 = pool.get(); // returns new MyClass
pool.release(obj1); // reset() is automatically called here
const obj3 = pool.get(); // obj3 is now identical to obj1
var Pool = require('opool');
function MyClass() {
MyClass.reset(this);
}
MyClass.reset = function(obj) {
obj.something = null;
}
var pool = new Pool(MyClass);
// Then somewhere deep down...
function() {
var obj = pool.get();
obj.something = 'test';
pool.release(obj); // You should stop using `obj` now
// obj.reset is automatically called here
}();
function() {
var obj2 = pool.get(); // This is actually the same as `obj` above.
console.log(obj2.something); // > null
obj2.something = 'test';
pool.release(obj2);
}();
FAQs
Simple & super fast object pool for javascript.
The npm package opool receives a total of 7 weekly downloads. As such, opool popularity was classified as not popular.
We found that opool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.