Skip to content
Permalink
Browse files

zlib,stream: use “official” util.types typechecks

The old variants have been deprecated since b20af80.

Refs: #18415

PR-URL: #19602
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
addaleax authored and trivikr committed Mar 25, 2018
1 parent ff7c2cc commit e76525728301abdcab4638c14d20f04049576db3
Showing with 13 additions and 10 deletions.
  1. +6 −7 lib/stream.js
  2. +7 −3 lib/zlib.js
@@ -38,16 +38,15 @@ Stream.Stream = Stream;

// Internal utilities
try {
Stream._isUint8Array = require('internal/util/types').isUint8Array;
} catch (e) {
// Throws for code outside of Node.js core.

try {
Stream._isUint8Array = process.binding('util').isUint8Array;
} catch (e) {
const types = require('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.
Stream._isUint8Array = process.binding('util').isUint8Array;
}
} catch (e) {
}

if (!Stream._isUint8Array) {
@@ -28,9 +28,13 @@ const {
ERR_ZLIB_INITIALIZATION_FAILED
} = require('internal/errors').codes;
const Transform = require('_stream_transform');
const { _extend } = require('util');
const { isAnyArrayBuffer } = process.binding('util');
const { isArrayBufferView } = require('internal/util/types');
const {
_extend,
types: {
isAnyArrayBuffer,
isArrayBufferView
}
} = require('util');
const binding = process.binding('zlib');
const assert = require('assert').ok;
const {

0 comments on commit e765257

Please sign in to comment.
You can’t perform that action at this time.