}
if (obj) {
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
if (isArrayBufferView(obj) || 'length' in obj) {
+ if (typeof obj.length !== 'number' || Number.isNaN(obj.length)) {
return createBuffer(0)
}
return fromArrayLike(obj)
byteOffset = -0x80000000
}
byteOffset = +byteOffset // Coerce to Number.
- if (isNaN(byteOffset)) {
+ if (Number.isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1)
}
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
- if (isNaN(parsed)) return i
+ if (Number.isNaN(parsed)) return i
buf[offset + i] = parsed
}
return i
return i
}
-function isnan (val) {
- return val !== val // eslint-disable-line no-self-compare
-}
-
// Node 0.10 supports `ArrayBuffer` but lacks `ArrayBuffer.isView`
function isArrayBufferView (obj) {
return (typeof ArrayBuffer.isView === 'function') && ArrayBuffer.isView(obj)