Skip to content

Commit

Permalink
stream: remove dead code
Browse files Browse the repository at this point in the history
`String.prototype.split()` returns an array of strings so the branch is
never taken.

Fixes: #30040

PR-URL: #30041
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
lpinca authored and MylesBorins committed Oct 23, 2019
1 parent f155dfe commit 46aa481
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,18 @@ Stream.Stream = Stream;

Stream._isUint8Array = require('internal/util/types').isUint8Array;

const version = process.version.substr(1).split('.');
if (version[0] === 0 && version[1] < 12) {
Stream._uint8ArrayToBuffer = Buffer;
} else {
try {
const internalBuffer = require('internal/buffer');
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
return new internalBuffer.FastBuffer(chunk.buffer,
chunk.byteOffset,
chunk.byteLength);
};
} catch (e) { // eslint-disable-line no-unused-vars
}
try {
const internalBuffer = require('internal/buffer');
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
return new internalBuffer.FastBuffer(chunk.buffer,
chunk.byteOffset,
chunk.byteLength);
};
} catch (e) { // eslint-disable-line no-unused-vars
}

if (!Stream._uint8ArrayToBuffer) {
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
return Buffer.prototype.slice.call(chunk);
};
}
if (!Stream._uint8ArrayToBuffer) {
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
return Buffer.prototype.slice.call(chunk);
};
}

0 comments on commit 46aa481

Please sign in to comment.