
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
object-pool
Advanced tools
A generic object pool which you can use for reducing object allocations when you're creating and removing lots of objects in quick succession. Or just to recycle objects, which is handy in cases such as game development.
npm install object-pool
pool = require('object-pool')([options])
Creates a new object pool, taking the following arguments:
init
: a factory method which should return a freshly created object.initSize
: a number to specify the initial size of reserved objects in the poolenable
: called on an object when it's added to the pool.disable
: called on an object when it's being removed from the pool.key
: this module stores a reference to each node on each object. Use
this option to change the key it uses. Defaults to __pool_node__
.pool.create()
Returns a fresh object from the pool. If there aren't any objects left in the
reserve, this will call init
to create a new object and then enable
on
the object to get it set up. Otherwise, this will retrieve an object from the
reserve and just call enable
on it.
pool.remove(object)
Removes an object from the pool, adding it to a reserve list to use later and
calling disable
on it.
pool.clean()
Empties the "reserve" list of leftover objects.
FAQs
An object pool for recycling objects without as much boilerplate
The npm package object-pool receives a total of 19 weekly downloads. As such, object-pool popularity was classified as not popular.
We found that object-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
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.