
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Minimal, no-dependencies memoization helper.
Lodash has a handy memoize function but it also has a ton of other functions.
Sindre Sorhus' mem is great but is also full of features you may not need.
This package is a simple, memoizing function implementation that does just that. No fancy options, just like an MVP.
npm install tiny-mem
const memoize = require('tiny-mem')
let index = 0
const seq = () => ++index
const memoized = memoize(seq)
memoized('one') // Returns 1
memoized('two') // Returns 2
memoized('two') // Returns 2 again
memoized('one') // Returns 1 again
memoized('two', 'one') // Still returns 2
Returns a memoized function.
Type: Function
A function.
Type: object
Type: object
Default: new Map()
The cache storage.
Must implement these methods: has(key), set(key, value), get(key) and delete(key)
Type: Function
Default: (...args) => args[0]
Determines how the caching key will be computed. By default, it will only consider the first argument and use strict equality to evaluate a match.
The memoized version of fn.
It resolves to the result of calling fn(), which is called only once per key.
FAQs
Minimal, no-dependencies memoization helper
We found that tiny-mem 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.