Skip to content

Commit 585d628

Browse files
atlowChemiMoLow
authored andcommitted
stream: deprecate asIndexedPairs
PR-URL: #48102 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent e88c079 commit 585d628

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

doc/api/stream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,6 +2431,11 @@ await Readable.from([1, 2, 3, 4]).take(2).toArray(); // [1, 2]
24312431

24322432
<!-- YAML
24332433
added: v17.5.0
2434+
changes:
2435+
- version: REPLACEME
2436+
pr-url: https://github.com/nodejs/node/pull/48102
2437+
description: Using the `asIndexedPairs` method emits a runtime warning that
2438+
it will be removed in a future version.
24342439
-->
24352440

24362441
> Stability: 1 - Experimental

lib/internal/streams/operators.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const {
2323
addAbortSignalNoValidate,
2424
} = require('internal/streams/add-abort-signal');
2525
const { isWritable, isNodeStream } = require('internal/streams/utils');
26+
const { deprecate } = require('internal/util');
2627

2728
const {
2829
ArrayPrototypePush,
@@ -420,7 +421,7 @@ function take(number, options = undefined) {
420421
}
421422

422423
module.exports.streamReturningOperators = {
423-
asIndexedPairs,
424+
asIndexedPairs: deprecate(asIndexedPairs, 'readable.asIndexedPairs will be removed in a future version.'),
424425
drop,
425426
filter,
426427
flatMap,

test/parallel/test-stream-iterator-helpers-test262-tests.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ import assert from 'assert';
6060
}
6161
// asIndexedPairs/length.js
6262
assert.strictEqual(Readable.prototype.asIndexedPairs.length, 0);
63-
// asIndexedPairs/name.js
64-
assert.strictEqual(Readable.prototype.asIndexedPairs.name, 'asIndexedPairs');
6563
const descriptor = Object.getOwnPropertyDescriptor(
6664
Readable.prototype,
6765
'asIndexedPairs'

0 commit comments

Comments
 (0)