stream: deprecate asIndexedPairs

PR-URL: https://github.com/nodejs/node/pull/48102
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
This commit is contained in:
Chemi Atlow authored and Moshe Atlow committed 2023-07-07 00:06:16 +03:00
1 parent e88c079022
commit 585d62848e
3 files changed
+7 -3

No files matched your search

+5
View File
@@ -2431,6 +2431,11 @@ await Readable.from([1, 2, 3, 4]).take(2).toArray(); // [1, 2]
<!-- YAML
added: v17.5.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
+2 -1
View File
@@ -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,
@@ -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,
@@ -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'