We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f9636a commit 4376b74Copy full SHA for 4376b74
1 file changed
lib/internal/webstreams/util.js
@@ -151,13 +151,13 @@ function peekQueueValue(controller) {
151
function enqueueValueWithSize(controller, value, size) {
152
assert(controller[kState].queue !== undefined);
153
assert(controller[kState].queueTotalSize !== undefined);
154
- size = +size;
155
- if (typeof size !== 'number' ||
156
- size < 0 ||
157
- NumberIsNaN(size) ||
158
- size === Infinity) {
+ const coercedSize = +size;
+ if (NumberIsNaN(coercedSize) ||
+ coercedSize < 0 ||
+ coercedSize === Infinity) {
159
throw new ERR_INVALID_ARG_VALUE.RangeError('size', size);
160
}
+ size = coercedSize;
161
ArrayPrototypePush(controller[kState].queue, { value, size });
162
controller[kState].queueTotalSize += size;
163
0 commit comments