Skip to content

Commit

Permalink
events: rename high & low watermark for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
atlowChemi committed Mar 14, 2024
1 parent b360532 commit 98fe47a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,8 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
* @param {{
* signal: AbortSignal;
* close?: string[];
* highWatermark?: number,
* lowWatermark?: number
* highWaterMark?: number,
* lowWaterMark?: number
* }} [options]
* @returns {AsyncIterator}
*/
Expand All @@ -1064,10 +1064,12 @@ function on(emitter, event, options = kEmptyObject) {
validateAbortSignal(signal, 'options.signal');
if (signal?.aborted)
throw new AbortError(undefined, { cause: signal?.reason });
const highWatermark = options.highWatermark ?? NumberMAX_SAFE_INTEGER;
validateInteger(highWatermark, 'options.highWatermark', 1);
const lowWatermark = options.lowWatermark ?? 1;
validateInteger(lowWatermark, 'options.lowWatermark', 1);
// Support for highWaterMark and highWatermark to avoid breaking change
const highWatermark = options.highWaterMark ?? options.highWatermark ?? NumberMAX_SAFE_INTEGER;
validateInteger(highWatermark, 'options.highWaterMark', 1);
// Support for lowWaterMark and lowWatermark to avoid breaking change
const lowWatermark = options.lowWaterMark ?? options.lowWatermark ?? 1;
validateInteger(lowWatermark, 'options.lowWaterMark', 1);

// Preparing controlling queues and variables
FixedQueue ??= require('internal/fixed_queue');
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/readline/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ class Interface extends InterfaceConstructor {
this[kLineObjectStream] = EventEmitter.on(
this, 'line', {
close: ['close'],
highWatermark: 1024,
highWaterMark: 1024,
[kFirstEventParam]: true,
});
}
Expand Down

0 comments on commit 98fe47a

Please sign in to comment.