Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
memoized-class-decorator
Advanced tools
A fork of memoized-decorator that takes class properties into consideration by attaching the memoization cache at the object level rather than class level.
Serializes arguments by .toString()
or JSON.strinigify
for objects literals
& arrays. null
& undefined
safe.
npm install --save memoized-class-decorator
import memoize = require('memoized-class-decorator');
class Foo {
constructor(private readonly num: number) { }
@memoize
public myMethod(add: number) {
return this.num + add;
}
}
const f1 = new Foo(5);
f1.myMethod(5); //= 10 (method is invoked)
f1.myMethod(10); //= 15 (method is invoked)
f1.myMethod(5); //= 10 (method is not invoked)
const f2 = new Foo(0);
f2.myMethod(5); //= 5 (method is invoked, each object has it's own cache)
Note that if an object is passed to the method with an id
property, the value of that propery will be used as the cache key. This is to reduce the time needed to serialize complex objects.
FAQs
Minimalistic memoization decorator
We found that memoized-class-decorator 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.