//#region src/function/memoize.d.ts /** * Creates a function that memoizes the result of func. * If resolver is provided, it determines the cache key for storing the result * based on the arguments provided to the memoized function. * * @template T - The type of the function to memoize * @param func - The function to have its output memoized * @param resolver - The function to resolve the cache key (optional) * @returns Returns the new memoized function * * @example * const fibonacci = memoize((n: number): number => { * if (n <= 1) return n; * return fibonacci(n - 1) + fibonacci(n - 2); * }); * fibonacci(10); // Calculates and caches * fibonacci(10); // Returns cached result * * @example * // With custom resolver * const memoized = memoize( * (a: number, b: number) => a + b, * (a: number, b: number) => `${a}-${b}` * ); * memoized(1, 2); // => 3 (calculates) * memoized(1, 2); // => 3 (cached) */ declare function memoize unknown>(func: T, resolver?: (...args: Parameters) => unknown): T & { cache: Map>; }; //#endregion export { memoize }; //# sourceMappingURL=memoize.d.cts.map