Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
func-cache
Advanced tools
This is the fun and cache.
It stores a map of results of a function and uses arguments as keys, for faster response,
Note that if the function result in different results with the same argument, the cache wouldn't work.
import funcache from "func-cache";
const cachedFibonacci = funcache(fibonacci);
function fibonnacci(num: number) {
let a = 1,
b = 0,
temp;
while (num >= 0) {
temp = a;
a = a + b;
b = temp;
num--;
}
return b;
}
console.log(cachedFibonacci(1000)); //-- viewing the result
funcache(fibonacci, {
// (1 sec) in miliseconds
lifeTime: 1000,
// place to store the cache, incase of restarts (browser only)
...localStorageCacher("_cachePlace_for_fibonacci"),
// place to store the cache, incase of restarts (server only)
...fSCacher("./_cachePlace_for_fibonacci.json"),
/** debounce time wait to call onDataUpdate, default 1000ms */
debounceTimer: 200,
/** incase the call is async, (sometimes the script doesn't detect it's async and wont run the await for it) default: false */
async: true,
});
FAQs
TypeScript library for caching static functions
The npm package func-cache receives a total of 20 weekly downloads. As such, func-cache popularity was classified as not popular.
We found that func-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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.