Use ArrayBuffer.isView to detect Buffer and ArrayBuffer

This commit is contained in:
Cheng Zhao 2016-07-25 16:39:09 +09:00
parent eb51e080e5
commit 1c9421bc89
5 changed files with 4 additions and 38 deletions

View file

@ -48,11 +48,6 @@ exports.defineProperties = function (exports) {
get: function () {
return require('../is-promise')
}
},
isTypedArray: {
get: function () {
return require('../is-typed-array')
}
}
})
}

View file

@ -1,17 +0,0 @@
'use strict'
module.exports = function isTypedArray (val) {
return (
val &&
(val instanceof Int8Array ||
val instanceof Int16Array ||
val instanceof Int32Array ||
val instanceof Uint8Array ||
val instanceof Uint8ClampedArray ||
val instanceof Uint16Array ||
val instanceof Uint32Array ||
val instanceof Float32Array ||
val instanceof Float64Array) ||
(Object.prototype.toString.call(val).substr(-6, 5) === 'Array')
)
}