Skip to content

Commit 4376b74

Browse files
committed
streams: remove unnecessary check
Signed-off-by: Antoine du Hamel <[email protected]>
1 parent 1f9636a commit 4376b74

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/internal/webstreams/util.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ function peekQueueValue(controller) {
151151
function enqueueValueWithSize(controller, value, size) {
152152
assert(controller[kState].queue !== undefined);
153153
assert(controller[kState].queueTotalSize !== undefined);
154-
size = +size;
155-
if (typeof size !== 'number' ||
156-
size < 0 ||
157-
NumberIsNaN(size) ||
158-
size === Infinity) {
154+
const coercedSize = +size;
155+
if (NumberIsNaN(coercedSize) ||
156+
coercedSize < 0 ||
157+
coercedSize === Infinity) {
159158
throw new ERR_INVALID_ARG_VALUE.RangeError('size', size);
160159
}
160+
size = coercedSize;
161161
ArrayPrototypePush(controller[kState].queue, { value, size });
162162
controller[kState].queueTotalSize += size;
163163
}

0 commit comments

Comments
 (0)