diff --git a/lib/tls.js b/lib/tls.js index 136fe50c78eed2..5a248c7d60ccf1 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -56,7 +56,6 @@ const internalUtil = require('internal/util'); internalUtil.assertCrypto(); const { isArrayBufferView, - isDataView, isUint8Array, } = require('internal/util/types'); @@ -148,16 +147,14 @@ exports.convertALPNProtocols = function convertALPNProtocols(protocols, out) { // If protocols is Array - translate it into buffer if (ArrayIsArray(protocols)) { out.ALPNProtocols = convertProtocols(protocols); - } else if (Buffer.isBuffer(protocols) || isUint8Array(protocols)) { + } else if (isUint8Array(protocols)) { // Copy new buffer not to be modified by user. out.ALPNProtocols = Buffer.from(protocols); - } else if (isDataView(protocols)) { + } else if (isArrayBufferView(protocols)) { out.ALPNProtocols = Buffer.from(protocols.buffer.slice( protocols.byteOffset, protocols.byteOffset + protocols.byteLength )); - } else if (isArrayBufferView(protocols)) { - out.ALPNProtocols = Buffer.from(protocols.slice().buffer); } };