null / string / array. None is a DataView → all false.
Real view. Built with new DataView(…) → true.
Safe call. Passing null does not throw.
Rule. Only DataView instances pass.
Example 3 — Buffer vs TypedArray vs DataView
All three can share the same bytes. Only the DataView passes.
Underscore
var buffer = new ArrayBuffer(8);
var bytes = new Uint8Array(buffer);
var view = new DataView(buffer);
console.log(_.isDataView(buffer)); // false
console.log(_.isDataView(bytes)); // false
console.log(_.isDataView(view)); // true
console.log(_.isDataView(bytes.buffer)); // false
DataView. Multi-byte get/set API → _.isDataView is true.
.buffer. Still an ArrayBuffer, not a DataView → false.
Example 4 — Offset vs Type
Full and sliced DataViews both pass. Offset is a separate property.
Underscore
var buffer = new ArrayBuffer(8);
var full = new DataView(buffer);
var slice = new DataView(buffer, 2, 4);
console.log(_.isDataView(full)); // true
console.log(_.isDataView(slice)); // true
console.log(slice.byteOffset, slice.byteLength); // 2 4
Full view. Covers the whole buffer → still a DataView.
Sliced view. Starts at offset 2 with length 4 → still a DataView.
Type vs layout._.isDataView ignores offset and length.
Read layout. Use byteOffset / byteLength when size matters.
Compatibility
Browser & Runtime Support
_.isDataView ships with Underscore.js 1.11.0+. It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore. DataView itself is a standard ES2015 feature.
✓ Stable · Underscore 1.11+
_.isDataView()
Available in [email protected]+ (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded and DataView exists. Older IE/Edge use a getInt8 + buffer fallback.
100%With Underscore 1.11+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.isDataViewUnderscore 1.11+
Bottom line: Safe for production once Underscore 1.11+ is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.isDataView(object) returns true only when the value is a DataView — for example new DataView(new ArrayBuffer(8)). Regular arrays, ArrayBuffers, TypedArrays, strings, numbers, null, and plain objects return false.
_.isDataView(new DataView(new ArrayBuffer(8))) returns true. The docs wrap a real ArrayBuffer in a DataView on purpose: that is the type the helper looks for.
No. An ArrayBuffer is the raw byte block. A DataView is a reader sitting on top of that block. Underscore treats an ArrayBuffer as not a DataView.
No. A Uint8Array is a typed view onto a buffer, not a DataView. Use DataView when you need mixed-endian get/set methods such as getInt8 or getFloat64.
typeof a DataView is "object", so typeof is too broad. instanceof DataView usually agrees in the same window. Underscore uses the [object DataView] tag, with a getInt8 plus buffer fallback in older IE/Edge.
No. It is a stable Underscore helper added in version 1.11.0, along with _.isArrayBuffer and _.isTypedArray. Use it before calling getInt8 or setFloat64.