Skip to content

Commit e87334e

Browse files
committed
chore: return object instead of tuple from getMinCursor
1 parent e21db2f commit e87334e

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/internal/streams/iter/broadcast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class BroadcastImpl {
343343
// Private methods
344344

345345
#recomputeMinCursor() {
346-
const [minCursor] = getMinCursor(
346+
const { minCursor } = getMinCursor(
347347
this.#consumers, this.#bufferStart + this.#buffer.length);
348348
this.#cachedMinCursor = minCursor;
349349
this.#minCursorDirty = false;

lib/internal/streams/iter/share.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class ShareImpl {
357357
}
358358

359359
#recomputeMinCursor() {
360-
const [minCursor, minCursorConsumers] = getMinCursor(
360+
const { minCursor, minCursorConsumers } = getMinCursor(
361361
this.#consumers, this.#bufferStart + this.#buffer.length);
362362
this.#cachedMinCursor = minCursor;
363363
this.#cachedMinCursorConsumers = minCursorConsumers;
@@ -606,7 +606,7 @@ class SyncShareImpl {
606606
}
607607

608608
#recomputeMinCursor() {
609-
const [minCursor, minCursorConsumers] = getMinCursor(
609+
const { minCursor, minCursorConsumers } = getMinCursor(
610610
this.#consumers, this.#bufferStart + this.#buffer.length);
611611
this.#cachedMinCursor = minCursor;
612612
this.#cachedMinCursorConsumers = minCursorConsumers;

lib/internal/streams/iter/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function onSignalAbort(signal, handler) {
7474
* consumers are at that cursor.
7575
* @param {Set} consumers - Set of objects with a `cursor` property
7676
* @param {number} fallback - Cursor to return when set is empty
77-
* @returns {[number, number]}
77+
* @returns {{ minCursor: number, minCursorConsumers: number }}
7878
*/
7979
function getMinCursor(consumers, fallback) {
8080
let minCursor = fallback;
@@ -87,7 +87,7 @@ function getMinCursor(consumers, fallback) {
8787
minCursorConsumers++;
8888
}
8989
}
90-
return [minCursor, minCursorConsumers];
90+
return { __proto__: null, minCursor, minCursorConsumers };
9191
}
9292

9393
/**

0 commit comments

Comments
 (0)