From c09e3deac5c84ae4bd43f430745d210a43d435f5 Mon Sep 17 00:00:00 2001 From: Vincent Dhennin Date: Wed, 27 Nov 2019 23:03:25 +0100 Subject: [PATCH] lib: replace ArrayBuffer.isView by primordial ArrayBuffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/30692 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Michaƫl Zasso Reviewed-By: Trivikram Kamat Reviewed-By: David Carlier --- lib/string_decoder.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/string_decoder.js b/lib/string_decoder.js index a070b4303de761..0ab74b772559c4 100644 --- a/lib/string_decoder.js +++ b/lib/string_decoder.js @@ -22,6 +22,7 @@ 'use strict'; const { + ArrayBufferIsView, ObjectDefineProperties, } = primordials; @@ -74,7 +75,7 @@ function StringDecoder(encoding) { StringDecoder.prototype.write = function write(buf) { if (typeof buf === 'string') return buf; - if (!ArrayBuffer.isView(buf)) + if (!ArrayBufferIsView(buf)) throw new ERR_INVALID_ARG_TYPE('buf', ['Buffer', 'TypedArray', 'DataView'], buf);