From 6a2934039cb180da48e3be00f127080b05f9b738 Mon Sep 17 00:00:00 2001 From: Chemi Atlow Date: Wed, 24 May 2023 10:44:48 +0300 Subject: [PATCH] stream: deprecate asIndexedPairs PR-URL: https://github.com/nodejs/node/pull/48102 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel Reviewed-By: Minwoo Jung --- doc/api/stream.md | 5 +++++ lib/internal/streams/operators.js | 3 ++- test/parallel/test-stream-iterator-helpers-test262-tests.mjs | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 4b204da5e8df51..21d6e33872f758 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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 diff --git a/lib/internal/streams/operators.js b/lib/internal/streams/operators.js index 65c87d6e456bdf..96e2a95476813d 100644 --- a/lib/internal/streams/operators.js +++ b/lib/internal/streams/operators.js @@ -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, diff --git a/test/parallel/test-stream-iterator-helpers-test262-tests.mjs b/test/parallel/test-stream-iterator-helpers-test262-tests.mjs index 8a153fc2fc283e..2f4f30e14c4cfe 100644 --- a/test/parallel/test-stream-iterator-helpers-test262-tests.mjs +++ b/test/parallel/test-stream-iterator-helpers-test262-tests.mjs @@ -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'