GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: remove unnecessary check · nodejs/node@cee279c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/webstreams
    • util.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/webstreams/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/util.js
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ const getNonWritablePropertyDescriptor = (value) => {
6262

6363
function extractHighWaterMark(value, defaultHWM) {
6464
if (value === undefined) return defaultHWM;
65-
value = +value;
66-
if (typeof value !== 'number' ||
67-
NumberIsNaN(value) ||
68-
value < 0)
65+
const coercedValue = +value;
66+
if (NumberIsNaN(coercedValue) ||
67+
coercedValue < 0)
6968
throw new ERR_INVALID_ARG_VALUE.RangeError('strategy.highWaterMark', value);
70-
return value;
69+
return coercedValue;
7170
}
7271

7372
function extractSizeAlgorithm(size) {
@@ -159,13 +158,13 @@ function peekQueueValue(controller) {
159158
function enqueueValueWithSize(controller, value, size) {
160159
assert(controller[kState].queue !== undefined);
161160
assert(controller[kState].queueTotalSize !== undefined);
162-
size = +size;
163-
if (typeof size !== 'number' ||
164-
size < 0 ||
165-
NumberIsNaN(size) ||
166-
size === Infinity) {
161+
const coercedSize = +size;
162+
if (NumberIsNaN(coercedSize) ||
163+
coercedSize < 0 ||
164+
coercedSize === Infinity) {
167165
throw new ERR_INVALID_ARG_VALUE.RangeError('size', size);
168166
}
167+
size = coercedSize;
169168
ArrayPrototypePush(controller[kState].queue, { value, size });
170169
controller[kState].queueTotalSize += size;
171170
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.