stream: simplify createPromiseCallback

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62650
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
This commit is contained in:
Antoine du Hamel committed 2026-05-05 16:19:25 +02:00
1 parent 1e8fa2f1bd
commit 450e0519d9
1 file changed
+2 -8
+2 -8
View File
@@ -11,6 +11,7 @@ const {
MathMax,
NumberIsNaN,
PromisePrototypeThen,
ReflectApply,
ReflectGet,
Symbol,
SymbolAsyncIterator,
@@ -166,15 +167,9 @@ function enqueueValueWithSize(controller, value, size) {
controller[kState].queueTotalSize += size;
}
// This implements "invoke a callback function type" for callback functions that return a promise.
// See https://webidl.spec.whatwg.org/#es-invoking-callback-functions
async function invokePromiseCallback(fn, thisArg, ...args) {
return FunctionPrototypeCall(fn, thisArg, ...args);
}
function createPromiseCallback(name, fn, thisArg) {
validateFunction(fn, name);
return (...args) => invokePromiseCallback(fn, thisArg, ...args);
return async (...args) => ReflectApply(fn, thisArg, args);
}
function isPromisePending(promise) {
@@ -281,7 +276,6 @@ module.exports = {
extractHighWaterMark,
extractSizeAlgorithm,
lazyTransfer,
invokePromiseCallback,
isBrandCheck,
isPromisePending,
peekQueueValue,