Skip to content

Commit 6a29340

Browse files
atlowChemiCeres6
authored andcommitted
stream: deprecate asIndexedPairs
PR-URL: nodejs#48102 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent 8b9ee30 commit 6a29340

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

doc/api/stream.md

+5
Original file line numberDiff line numberDiff line change
@@ -2453,6 +2453,11 @@ await Readable.from([1, 2, 3, 4]).take(2).toArray(); // [1, 2]
24532453
added:
24542454
- v17.5.0
24552455
- v16.15.0
2456+
changes:
2457+
- version: REPLACEME
2458+
pr-url: https://github.com/nodejs/node/pull/48102
2459+
description: Using the `asIndexedPairs` method emits a runtime warning that
2460+
it will be removed in a future version.
24562461
-->
24572462

24582463
> Stability: 1 - Experimental

lib/internal/streams/operators.js

+2-1
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

-2
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)