Simple memoization using WeakMap. Only suitable for functions with single argument of non-primitive type.
const addFlag = obj => ({...obj, flag: true });const memoize = memoizeWeak(addFlag));const test = {test: 1};memoize(test); // from addFlag callmemoize({test: 1}); // from addFlag call;memoize(test); // from cache
Generated using TypeDoc
Simple memoization using WeakMap. Only suitable for functions with single argument of non-primitive type.