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

Function close

lib/internal/streams/from.js:85–99  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

83 };
84
85 async function close(error) {
86 const hadError = (error !== undefined) && (error !== null);
87 const hasThrow = typeof iterator.throw === 'function';
88 if (hadError && hasThrow) {
89 const { value, done } = await iterator.throw(error);
90 await value;
91 if (done) {
92 return;
93 }
94 }
95 if (typeof iterator.return === 'function') {
96 const { value } = await iterator.return();
97 await value;
98 }
99 }
100
101 // There are a lot of duplication here, it's done on purpose for performance
102 // reasons - avoid await when not needed.

Callers 1

fromFunction · 0.70

Calls 2

throwMethod · 0.45
returnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…