
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@pacote/memoize
Advanced tools
Speed up consecutive calls of the same function with the same arguments by caching its results.
yarn add @pacote/memoize
import { memoize } from '@pacote/memoize'
const randomFunction = (prefix: string) => `${prefix}${Math.random()}`
const memoizedFunction = memoize((prefix) => `key_${prefix}`, randomFunction)
memoizedFunction('foo') // 'foo' followed by randomly-generated number.
memoizedFunction('foo') // Same result as previous call with 'foo'.
memoizedFunction('bar') // 'bar' followed by randomly-generated number.
memoizedFunction('bar') // Same result as previous call with 'bar'.
memoize<A, T>(cacheKeyFn: (...args: A) => string, fn: (...args: A) => T): (...args: A) => T
memoize()
takes two function arguments:
A function that generates a string key for cached results. This function takes the same arguments as the function to memoize.
The function to memoize. memoize()
returns a version of this function that caches results.
MIT © Luís Rodrigues.
FAQs
Memoization function.
The npm package @pacote/memoize receives a total of 366 weekly downloads. As such, @pacote/memoize popularity was classified as not popular.
We found that @pacote/memoize 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
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.