import type { Callable } from "@emprespresso/pengueno"; export const memoize = >(fn: F): F => { const cache = new Map(); return ((...args: unknown[]): R => { const key = JSON.stringify(args); if (cache.has(key)) { return cache.get(key)!; } const res = fn.apply(args); cache.set(key, res); return res; }) as F; };