Skip to content

Commit

Permalink
stream: deprecate asIndexedPairs
Browse files Browse the repository at this point in the history
  • Loading branch information
atlowChemi committed May 21, 2023
1 parent 260092e commit a63bb8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
15 changes: 15 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,20 @@ In a future version of Node.js, [`assert.CallTracker`][],
will be removed.
Consider using alternatives such as the [`mock`][] helper function.

### DEP0174: the `readable.asIndexedPairs` class

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/48102
description: Runtime deprecation.
-->

Type: Runtime

In a future version of Node.js, [`readable.asIndexedPairs`][],
will be removed.

[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
Expand Down Expand Up @@ -3470,6 +3484,7 @@ Consider using alternatives such as the [`mock`][] helper function.
[`process.mainModule`]: process.md#processmainmodule
[`punycode`]: punycode.md
[`readable.readableEnded`]: stream.md#readablereadableended
[`readable.asIndexedPairs`]: stream.md#readableasindexedpairsoptions
[`request.abort()`]: http.md#requestabort
[`request.connection`]: http.md#requestconnection
[`request.destroy()`]: http.md#requestdestroyerror
Expand Down
7 changes: 6 additions & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -2453,9 +2453,14 @@ 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: the `asIndexedPairs` property has been deprecated and will be
removed in a future version.
-->

> Stability: 1 - Experimental
> Stability: 0 - Deprecated
* `options` {Object}
* `signal` {AbortSignal} allows destroying the stream if the signal is
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 is deprecated.', 'DEP0174'),
drop,
filter,
flatMap,
Expand Down

0 comments on commit a63bb8a

Please sign in to comment.