What is lazy-object-proxy and when to use it
masterConcept
lazy-object-proxy is a fast and thorough lazy object proxy. It is designed for scenarios where the target object is only available or needed much later in the execution flow.
Comparison with wrapt.ObjectProxy
While both are proxies, they serve different primary purposes:
- Use
lazy-object-proxywhen you want to wrap a function that produces an object, and you want that function to be called only upon the first use of the proxy. - Use
wrapt.ObjectProxywhen you want to override specific methods (via subclassing) and forward all other calls to an existing target object.