Skip to content

Commit

Permalink
stream: deprecate asIndexedPairs
Browse files Browse the repository at this point in the history
PR-URL: nodejs#48102
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
  • Loading branch information
atlowChemi authored and Ceres6 committed Aug 14, 2023
1 parent 8b9ee30 commit 6a29340
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,11 @@ await Readable.from([1, 2, 3, 4]).take(2).toArray(); // [1, 2]
added:
- v17.5.0
- v16.15.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/48102
description: Using the `asIndexedPairs` method emits a runtime warning that
it will be removed in a future version.
-->

> Stability: 1 - Experimental
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/streams/operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const {
addAbortSignalNoValidate,
} = require('internal/streams/add-abort-signal');
const { isWritable, isNodeStream } = require('internal/streams/utils');
const { deprecate } = require('internal/util');

const {
ArrayPrototypePush,
Expand Down Expand Up @@ -420,7 +421,7 @@ function take(number, options = undefined) {
}

module.exports.streamReturningOperators = {
asIndexedPairs,
asIndexedPairs: deprecate(asIndexedPairs, 'readable.asIndexedPairs will be removed in a future version.'),
drop,
filter,
flatMap,
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-stream-iterator-helpers-test262-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ import assert from 'assert';
}
// asIndexedPairs/length.js
assert.strictEqual(Readable.prototype.asIndexedPairs.length, 0);
// asIndexedPairs/name.js
assert.strictEqual(Readable.prototype.asIndexedPairs.name, 'asIndexedPairs');
const descriptor = Object.getOwnPropertyDescriptor(
Readable.prototype,
'asIndexedPairs'
Expand Down

0 comments on commit 6a29340

Please sign in to comment.