Lodash _.isArrayBuffer() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is classified as an ArrayBuffer object — a fixed-length raw binary buffer. Typed-array views are different. Part of Lodash Lang since 4.3.0 (stable — not deprecated).

Pass the value you want to inspect or convert. Read the return type carefully before you use the result.

Syntax

Call _.isArrayBuffer. Start with this line.

Lodash
_.isArrayBuffer(value)
CallWhat it does
_.isArrayBuffer(value)Primary signature.

Prefer import isArrayBuffer from "lodash/isArrayBuffer" when you want a smaller bundle.

Library declarations
Lodash
_.isArrayBuffer(value)

Parameters

ParameterDescription
valueRequired. The value to check

Return Value

Return ValueDescription
*true if ArrayBuffer, else false

Lodash Examples

Example 1 — Official: Real ArrayBuffer

A constructed ArrayBuffer passes the check.

Lodash
_.isArrayBuffer(new ArrayBuffer(2));
// → true
Try It Yourself

How It Works

  1. Create. Official sample: new ArrayBuffer(2) — 2 bytes.
  2. Type. It is a real ArrayBuffer instance.
  3. Result. true.
  4. Use. Pass this buffer to views like Uint8Array when you need to read bytes.

Example 2 — Official: Normal Array

A JavaScript Array is not an ArrayBuffer — names are similar, types are not.

Lodash
_.isArrayBuffer(new Array(2));
// → false
Try It Yourself

How It Works

  1. Input. new Array(2) builds a sparse Array of length 2.
  2. Wrong type. It is an Array, not a binary buffer.
  3. Result. false.
  4. Check arrays with. _.isArray.

Example 3 — Typed Array Is a View

Uint8Array wraps a buffer — it is not the buffer itself.

Lodash
var view = new Uint8Array(2);

_.isArrayBuffer(view);          // → false
_.isTypedArray(view);           // → true
_.isArrayBuffer(view.buffer);   // → true
Try It Yourself

How It Works

  1. View. Uint8Array is a typed-array view → isArrayBuffer is false.
  2. Typed check. _.isTypedArray(view) is true.
  3. Underlying buffer. view.buffer is the raw ArrayBuffer → true.
  4. Rule. Buffer = storage; view = how you read it.

Example 4 — DataView Is Also a View

DataView reads a buffer with flexible endianness — still not an ArrayBuffer.

Lodash
var buf = new ArrayBuffer(4);
var dv = new DataView(buf);

_.isArrayBuffer(dv);    // → false
_.isArrayBuffer(buf);   // → true
Try It Yourself

How It Works

  1. Buffer. Create a 4-byte ArrayBuffer.
  2. Wrap. DataView is a view over that buffer.
  3. Checks. The view fails; the buffer passes.
  4. Native tip. ArrayBuffer.isView(dv) is true.

Example 5 — Duck Typing Fails

An object that only looks like a buffer is not an ArrayBuffer.

Lodash
_.isArrayBuffer({ byteLength: 2 });
// → false

_.isArrayBuffer(null);
// → false
Try It Yourself

How It Works

  1. Shape. Having byteLength is not enough.
  2. null. Not an ArrayBuffer → false.
  3. Safe. Always returns a boolean — no throw.
  4. Rule. Only real ArrayBuffer instances pass.

Browser & Runtime Support

_.isArrayBuffer is a Lodash Lang helper (added in 4.3.0). It needs a runtime that provides ArrayBuffer (all modern browsers and Node). It runs anywhere Lodash 4.3+ runs — CDN/bundle in browsers and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 4.3.0+

_.isArrayBuffer()

Available in [email protected]+ full builds and the lodash/isArrayBuffer modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.3.0+
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.isArrayBuffer Lodash 4.3.0+

Bottom line: Safe for production once Lodash 4.3.0+ is on the page or in your bundle. Prefer import isArrayBuffer from "lodash/isArrayBuffer" for smaller builds. Native value instanceof ArrayBuffer is a close alternative in same-realm code.

Frequently Asked Questions

_.isArrayBuffer(value) returns true if value is classified as an ArrayBuffer object — a raw fixed-length binary buffer — otherwise false.
No. Typed arrays are views over an ArrayBuffer, not ArrayBuffers themselves. Use _.isTypedArray or ArrayBuffer.isView for views.
SharedArrayBuffer is a different built-in. _.isArrayBuffer does not treat it as a normal ArrayBuffer. Use a dedicated check when you need shared memory.
No. Lodash checks real ArrayBuffer instances, not duck-typed shapes.
In Node, Buffer is a separate type from ArrayBuffer. Use _.isBuffer (or Buffer.isBuffer) for Node buffers.
Use import isArrayBuffer from "lodash/isArrayBuffer" or require("lodash/isArrayBuffer") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.isArrayBuffer.

Next: _.isArrayLike()

Check whether a value has indexed keys and a valid length.

_.isArrayLike() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful