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:
parent
1b110396e7
commit
744c734716
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user