
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
weakref-store
Advanced tools
A WeakRef-based cache that automatically evicts entries when values are garbage collected
A WeakRef-based cache that automatically evicts entries when values are garbage collected
npm install weakref-store
import WeakCache from 'weakref-store';
const cache = new WeakCache({
onEvict(key) {
console.log(`${key} was garbage collected`);
},
});
let value = {data: 'hello'};
cache.set('key', value);
console.log(cache.get('key'));
//=> {data: 'hello'}
console.log(cache.has('key'));
//=> true
Type: object
Type: (key) => void
Callback invoked with the key when an entry is evicted by garbage collection.
Returns the value for the key, or undefined if the key does not exist or its value has been garbage collected.
Set a key-value pair. The value must be an object (required for WeakRef). Throws TypeError for primitives.
Returns true if the key exists and the value is still alive.
Removes an entry. Returns true if the entry existed.
The approximate number of entries. May include entries whose values have been collected but not yet finalized.
MIT
FAQs
A WeakRef-based cache that automatically evicts entries when values are garbage collected
The npm package weakref-store receives a total of 5 weekly downloads. As such, weakref-store popularity was classified as not popular.
We found that weakref-store demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.