UNPKG

@naturalcycles/js-lib

Version:

Standard library for universal (browser + Node.js) javascript

14 lines (13 loc) 624 B
import type { CommonLogger } from '../log/commonLogger.js'; export interface MemoOpts { logger?: CommonLogger; } /** * Memoizes the method of the class, so it caches the output and returns the cached version if the "key" * of the cache is the same. Key, by defaul, is calculated as `JSON.stringify(...args)`. * Cache is stored indefinitely in internal Map. * There is more advanced version of memo decorator called `memoCache`. * * Supports dropping it's cache by calling .dropCache() method of decorated function (useful in unit testing). */ export declare const memoSimple: (opt?: MemoOpts) => MethodDecorator;