UNPKG

thorish

Version:

This is a library of useful JS concepts and data structures for Node and the browser. It it, unashamedly, a dumping ground for code needed by [@samthor](https://twitter.com/samthor)'s projects.

24 lines (23 loc) 910 B
/** * Purge any previously memoized calls for a function passed to {@link memoize} or * {@link memoizeWeak}. */ export declare function purgeMemoize(fn: Function): void; /** * Clears a specific memoized call. * * @returns `true` if it was cleared, `false` if not found */ export declare function clearMemoize<T, R>(fn: (...args: T[]) => R, ...args: T[]): boolean; /** * Calls the passed {@link Function} but memoize the result based on the function arguments. * The memoize state is stored globally based on the function ref. * * Matching calls to this helper will return the same result. * Holds the object parameters (i.e., non-nullable typeof 'object') weakly. */ export declare function callMemoize<T, R>(fn: (...args: T[]) => R, ...args: T[]): R; /** * Build a memoized version of the passed function. */ export declare function memoize<T, R>(fn: (...args: T[]) => R): (...args: T[]) => R;