MCPcopy Index your code
hub / github.com/nodejs/node / returnSteps

Method returnSteps

lib/internal/webstreams/readablestream.js:527–546  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

525 }
526
527 async function returnSteps(value) {
528 if (state.done)
529 return { done: true, value }; // eslint-disable-line node-core/avoid-prototype-pollution
530 state.done = true;
531
532 if (reader[kState].stream === undefined) {
533 throw new ERR_INVALID_STATE.TypeError(
534 'The reader is not bound to a ReadableStream');
535 }
536 assert(!reader[kState].readRequests.length);
537 if (!preventCancel) {
538 const result = readableStreamReaderGenericCancel(reader, value);
539 readableStreamReaderGenericRelease(reader);
540 await result;
541 return { done: true, value }; // eslint-disable-line node-core/avoid-prototype-pollution
542 }
543
544 readableStreamReaderGenericRelease(reader);
545 return { done: true, value }; // eslint-disable-line node-core/avoid-prototype-pollution
546 }
547
548 // TODO(@jasnell): Explore whether an async generator
549 // can be used here instead of a custom iterator object.

Callers

nothing calls this directly

Calls 3

assertFunction · 0.50

Tested by

no test coverage detected