}
if (obj) {
- if (isArrayBufferView(obj) || 'length' in obj) {
+ if (ArrayBuffer.isView(obj) || 'length' in obj) {
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
return createBuffer(0)
}
var pos = 0
for (i = 0; i < list.length; ++i) {
var buf = list[i]
- if (isArrayBufferView(buf)) {
+ if (ArrayBuffer.isView(buf)) {
buf = Buffer.from(buf)
}
if (!Buffer.isBuffer(buf)) {
if (Buffer.isBuffer(string)) {
return string.length
}
- if (isArrayBufferView(string) || isArrayBuffer(string)) {
+ if (ArrayBuffer.isView(string) || isArrayBuffer(string)) {
return string.byteLength
}
if (typeof string !== 'string') {
typeof obj.byteLength === 'number')
}
-// Node 0.10 supports `ArrayBuffer` but lacks `ArrayBuffer.isView`
-function isArrayBufferView (obj) {
- return (typeof ArrayBuffer.isView === 'function') && ArrayBuffer.isView(obj)
-}
-
function numberIsNaN (obj) {
return obj !== obj // eslint-disable-line no-self-compare
}