UNPKG

@liveblocks/react-ui

Version:

A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.

19 lines (16 loc) 450 B
import { stableStringify } from '@liveblocks/core'; function memoize(fn) { const cache = /* @__PURE__ */ new Map(); return (...args) => { const key = JSON.stringify(args.map((arg) => stableStringify(arg))); const cached = cache.get(key); if (cached !== void 0) { return cached; } const result = fn(...args); cache.set(key, result); return result; }; } export { memoize }; //# sourceMappingURL=memoize.js.map