Defines a PropertyDescriptor for an object's memoized method. Caches the results of method calls on a per-instance basis.
The name of the method
The method implementation
A PropertyDescriptor containing the memoization logic
Object.defineProperty(target, 'calc', memoizeMethod('calc', () => 42)); Copy
Object.defineProperty(target, 'calc', memoizeMethod('calc', () => 42));
Defines a PropertyDescriptor for an object's memoized method. Caches the results of method calls on a per-instance basis.