UNPKG

@daysnap/utils

Version:
14 lines (12 loc) 271 B
// src/cached.ts function cached(fn) { const cache = /* @__PURE__ */ Object.create(null); return function cachedFn(...args) { const key = JSON.stringify(args); const hit = cache[key]; return hit || (cache[key] = fn(...args)); }; } export { cached };