@tempots/std

memoize() function

Memoizes the result of a function and returns a new function that caches the result. The cached result is returned if available, otherwise the original function is called and the result is cached for future invocations.

Signature:

memoize: (f: () => NonNullable) => (() => NonNullable)

Parameters

Parameter

Type

Description

f

() => NonNullable

The function to memoize.

Returns: (() => NonNullable)

A new function that caches the result of the original function.