Skip to main content
cngx-src documentation

memoize

Functioncore/utils

projects/core/utils/memo.util.ts

Description#

Creates a memoized version of a single-argument pure function. Each call to memoize() produces an independent cache.

const expensive = memoize((id: string) => computeHeavy(id)); expensive('a'); // computes expensive('a'); // cached

Signature#

memoize(fn)

Parameters#

@paramfn

Returns#

V