Skip to content

Weird dead code in lib/stream.js #30040

Closed
@isaacs

Description

@isaacs

Noticed this bit of code in lib/stream.js on the master branch:

const version = process.version.substr(1).split('.');
if (version[0] === 0 && version[1] < 12) {
  Stream._uint8ArrayToBuffer = Buffer;
} else {
  ...
  1. Since the code internal in node can only ever be the version that it is, it seems odd to be checking the version in this way.
  2. It looks like it's checking for node 0.x < 0.12??
  3. Splitting a string returns an array of strings, so version[0] === 0 would always return false even in node 0.11 and before.

I think this can be removed?

  • Version: 12.12.0
  • Platform: All
  • Subsystem: stream

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions