
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@zherdev/ts-cache
Advanced tools
A typescript decorator for pure methods which improves your performance.
If you have a complicated method which is called many times and takes a long time you can just add @Cache() decorator to it.
import { Cache } from '@zherdev/ts-cache';
class ExampleClass {
@Cache()
method(count: number): number {
console.log(`Execution with value: ${count}`);
let sum = 0;
for (let i = 0; i < count; i++) {
sum++;
}
return sum;
}
}
const obj = new ExampleClass();
const res1 = obj.method(1000000); // Takes some time
const res2 = obj.method(1000000); // Instant execution
const res3 = obj.method(9999999); // Takes some time
console.log(res1, res2);
console.log(`res1: ${res1}`);
console.log(`res2: ${res2}`);
console.log(`res3: ${res3}`);
/* Console output
Execution with value: 1000000
Execution with value: 9999999
res1: 1000000
res2: 1000000
res3: 9999999
*/
You can see that obj.method() was called twice but executed only once. Anyway we have the same result in both variables: res1 and res2.
It's because every time when you call your method with the same arguments as once before it returns result instantly. @Cache() decorator just keeps it in memory.
Be careful with
@Cache()decorator. It may cause some unexpected behavior if your method need to be executed every time it's called.
FAQs
A typescript decorator for pure methods which improves your performance.
We found that @zherdev/ts-cache 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.