
Product
Introducing Socket MCP for Claude Desktop
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
@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 500 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.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.