Skip to content

Commit 2dc52ad

Browse files
addaleaxBridgeAR
authored andcommitted
stream: simplify isUint8Array helper
The fallback code is no longer used when exporting to readable-stream. Refs: #29475 PR-URL: #29514 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
1 parent 3aea277 commit 2dc52ad

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

lib/stream.js

+1-23
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
'use strict';
2323

24-
const { Object } = primordials;
25-
2624
const { Buffer } = require('buffer');
2725
const pipeline = require('internal/streams/pipeline');
2826
const eos = require('internal/streams/end-of-stream');
@@ -43,27 +41,7 @@ Stream.finished = eos;
4341
// Backwards-compat with node 0.4.x
4442
Stream.Stream = Stream;
4543

46-
// Internal utilities
47-
try {
48-
const types = require('internal/util/types');
49-
if (types && typeof types.isUint8Array === 'function') {
50-
Stream._isUint8Array = types.isUint8Array;
51-
} else {
52-
// This throws for Node < 4.2.0 because there's no util binding and
53-
// returns undefined for Node < 7.4.0.
54-
// Please do not convert process.binding() to internalBinding() here.
55-
// This is for compatibility with older versions when loaded as
56-
// readable-stream.
57-
Stream._isUint8Array = process.binding('util').isUint8Array;
58-
}
59-
} catch (e) { // eslint-disable-line no-unused-vars
60-
}
61-
62-
if (!Stream._isUint8Array) {
63-
Stream._isUint8Array = function _isUint8Array(obj) {
64-
return Object.prototype.toString.call(obj) === '[object Uint8Array]';
65-
};
66-
}
44+
Stream._isUint8Array = require('internal/util/types').isUint8Array;
6745

6846
const version = process.version.substr(1).split('.');
6947
if (version[0] === 0 && version[1] < 12) {

0 commit comments

Comments
 (0)