@@ -184,7 +184,7 @@ const LAZY_PROXY_HANDLER: ProxyHandler<ProxyTarget<object>> =
184
184
) ;
185
185
186
186
/**
187
- * Returns an proxy object whose underlying object will be lazily created
187
+ * Returns an proxy object backed by `tailCall`, which will be lazily created
188
188
* at the first time its properties or methods are used.
189
189
*
190
190
* `lazy` can eliminate tail calls, preventing stack overflow errors in tail
@@ -291,10 +291,10 @@ export function lazy<T extends object>(tailCall: () => T): T {
291
291
/**
292
292
* Performs a tail call as soon as possible.
293
293
*
294
- * @ returns either directly the object returned by `tailCall`, or a proxy
295
- * object if there are any other running tail calls. When a proxy object is
296
- * returned, the underlying object will be created after all the previous tail
297
- * calls are finished.
294
+ * `parasitic` returns either exactly the object returned by `tailCall`, or a
295
+ * proxy object backed by the object returned by `tailCall`, if there are any
296
+ * previously started pending tail calls. In the latter case, the underlying
297
+ * object will be created after all the previous tail calls are finished.
298
298
*
299
299
* @param tailCall the function to create the underlying object
300
300
*
@@ -307,16 +307,16 @@ export function lazy<T extends object>(tailCall: () => T): T {
307
307
* import { parasitic } from 'tail-call-proxy';
308
308
*
309
309
* let counter = 0;
310
- * const lazyObject = parasitic(() => {
310
+ * const parasiticObject = parasitic(() => {
311
311
* counter++;
312
312
* return { hello: 'world' };
313
313
* });
314
314
* expect(counter).toBe(1);
315
315
*
316
- * expect(lazyObject .hello).toBe('world');
316
+ * expect(parasiticObject .hello).toBe('world');
317
317
* expect(counter).toBe(1);
318
318
*
319
- * expect(lazyObject .hello).toBe('world');
319
+ * expect(parasiticObject .hello).toBe('world');
320
320
* expect(counter).toBe(1);
321
321
* ```
322
322
*
0 commit comments