summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-09-09 23:54:59 +0200
committerMatteo Collina <hello@matteocollina.com>2019-09-12 14:58:25 +0200
commita33aa9293436e512a566524ac428e999dc9ca1f9 (patch)
tree51aa415bb0525ea80e9999cc7c1acc598eb07fb5 /lib
parent7b32654ab9c54209e9d545d1e3a536eb5361bceb (diff)
downloadandroid-node-v8-a33aa9293436e512a566524ac428e999dc9ca1f9.tar.gz
android-node-v8-a33aa9293436e512a566524ac428e999dc9ca1f9.tar.bz2
android-node-v8-a33aa9293436e512a566524ac428e999dc9ca1f9.zip
stream: simplify isUint8Array helper
The fallback code is no longer used when exporting to readable-stream. Refs: https://github.com/nodejs/node/pull/29475 PR-URL: https://github.com/nodejs/node/pull/29514 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.js24
1 files changed, 1 insertions, 23 deletions
diff --git a/lib/stream.js b/lib/stream.js
index 4918434167..826f0e6d9a 100644
--- a/lib/stream.js
+++ b/lib/stream.js
@@ -21,8 +21,6 @@
'use strict';
-const { Object } = primordials;
-
const { Buffer } = require('buffer');
const pipeline = require('internal/streams/pipeline');
const eos = require('internal/streams/end-of-stream');
@@ -43,27 +41,7 @@ Stream.finished = eos;
// Backwards-compat with node 0.4.x
Stream.Stream = Stream;
-// Internal utilities
-try {
- const types = require('internal/util/types');
- if (types && typeof types.isUint8Array === 'function') {
- Stream._isUint8Array = types.isUint8Array;
- } else {
- // This throws for Node < 4.2.0 because there's no util binding and
- // returns undefined for Node < 7.4.0.
- // Please do not convert process.binding() to internalBinding() here.
- // This is for compatibility with older versions when loaded as
- // readable-stream.
- Stream._isUint8Array = process.binding('util').isUint8Array;
- }
-} catch (e) { // eslint-disable-line no-unused-vars
-}
-
-if (!Stream._isUint8Array) {
- Stream._isUint8Array = function _isUint8Array(obj) {
- return Object.prototype.toString.call(obj) === '[object Uint8Array]';
- };
-}
+Stream._isUint8Array = require('internal/util/types').isUint8Array;
const version = process.version.substr(1).split('.');
if (version[0] === 0 && version[1] < 12) {