Skip to content

Commit 7bfb0b4

Browse files
atlowChemimarco-ippolito
authored andcommitted
events: rename high & low watermark for consistency
PR-URL: #52080 Fixes: #52078 Refs: #41276 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 7e35a16 commit 7bfb0b4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/events.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,8 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
10511051
* @param {{
10521052
* signal: AbortSignal;
10531053
* close?: string[];
1054-
* highWatermark?: number,
1055-
* lowWatermark?: number
1054+
* highWaterMark?: number,
1055+
* lowWaterMark?: number
10561056
* }} [options]
10571057
* @returns {AsyncIterator}
10581058
*/
@@ -1062,10 +1062,12 @@ function on(emitter, event, options = kEmptyObject) {
10621062
validateAbortSignal(signal, 'options.signal');
10631063
if (signal?.aborted)
10641064
throw new AbortError(undefined, { cause: signal?.reason });
1065-
const highWatermark = options.highWatermark ?? NumberMAX_SAFE_INTEGER;
1066-
validateInteger(highWatermark, 'options.highWatermark', 1);
1067-
const lowWatermark = options.lowWatermark ?? 1;
1068-
validateInteger(lowWatermark, 'options.lowWatermark', 1);
1065+
// Support both highWaterMark and highWatermark for backward compatibility
1066+
const highWatermark = options.highWaterMark ?? options.highWatermark ?? NumberMAX_SAFE_INTEGER;
1067+
validateInteger(highWatermark, 'options.highWaterMark', 1);
1068+
// Support both lowWaterMark and lowWatermark for backward compatibility
1069+
const lowWatermark = options.lowWaterMark ?? options.lowWatermark ?? 1;
1070+
validateInteger(lowWatermark, 'options.lowWaterMark', 1);
10691071

10701072
// Preparing controlling queues and variables
10711073
FixedQueue ??= require('internal/fixed_queue');

lib/internal/readline/interface.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ class Interface extends InterfaceConstructor {
13591359
this[kLineObjectStream] = EventEmitter.on(
13601360
this, 'line', {
13611361
close: ['close'],
1362-
highWatermark: 1024,
1362+
highWaterMark: 1024,
13631363
[kFirstEventParam]: true,
13641364
});
13651365
}

0 commit comments

Comments
 (0)