lib: replace ArrayBuffer.isView by primordial ArrayBuffer

PR-URL: https://github.com/nodejs/node/pull/30692
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
This commit is contained in:
Vincent Dhennin 2019-11-27 23:03:25 +01:00 committed by Anna Henningsen
parent 1b110396e7
commit 744c734716
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -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);