@oaklean/profiler-core
Version:
Part of the @oaklean suite. It provides all basic functions to work with the `.oak` file format. It allows parsing the `.oak` file format as well as tools for analyzing the measurement values. It also provides all necessary capabilities required for prec
21 lines (20 loc) • 688 B
TypeScript
/**
* Memoizes a function by caching its results for future invocations with the same arguments.
* @param func The function to memoize.
* @returns A memoized version of the function.
*
* Example usage:
*
* function expensiveOperation(n: number): number {
* console.log('Computing...');
* return n * 2;
* }
*
* const memoizedOperation = memoize(expensiveOperation);
*
* console.log(memoizedOperation(5)); // Computing... 10
* console.log(memoizedOperation(5)); // 10 (cached)
* console.log(memoizedOperation(6)); // Computing... 12
* console.log(memoizedOperation(6)); // 12 (cached)
*/
export declare function memoize<T extends (...args: any[]) => any>(func: T): T;