Lodash _.isTypedArray() method

Beginner
⏱️ 6 min read
📚 Updated: May 2026
🎯 3 Code examples
🚀 3 Try-it labs
Lodash

What you’ll learn

  • How _.isTypedArray(value) recognizes all nine native TypedArray views.
  • Why ArrayBuffer and DataView are excluded.
  • How this differs from Array.isArray.
  • Where TypedArray guards belong in binary protocol, WebGL, and Web Audio pipelines.

Prerequisites

You know that TypedArrays are fixed-element views over a backing ArrayBuffer.

  • You have used at least one of Uint8Array, Int16Array, or Float32Array.
  • Try-it labs load lodash from the CDN.

Overview

Use _.isTypedArray before invoking element-aware operations on binary data—copying ranges, encoding/decoding samples, or feeding pixel buffers into GPU APIs.

Nine views

All native integer and float TypedArrays qualify.

Not the buffer

ArrayBuffer and DataView are excluded.

Binary-safe gate

Prevents arrays of mixed types from sneaking into byte pipelines.

Syntax

javascript
_.isTypedArray(value)
  • value: any value to test.
  • Returns: true when value is a TypedArray view; otherwise false.
1

Uint8Array, Float64Array, and friends

The lodash docs baseline: new Uint8Array returns true—and the same applies to every other native view.

javascript
import isTypedArray from "lodash/isTypedArray";

console.log(
  "u8: " + isTypedArray(new Uint8Array([1, 2, 3])) + "\n" + // true (lodash docs)
  "f64: " + isTypedArray(new Float64Array(4)) + "\n" +       // true
  "i16: " + isTypedArray(new Int16Array([0, -1]))            // true
);
Try it Yourself
2

ArrayBuffer and DataView

The raw buffer and its flexible accessor are not TypedArrays—both return false.

javascript
import isTypedArray from "lodash/isTypedArray";

const buf = new ArrayBuffer(8);
const view = new DataView(buf);

console.log(
  "buf: " + isTypedArray(buf) + "\n" +          // false
  "dataView: " + isTypedArray(view)              // false
);
Try it Yourself
3

Plain arrays and nullish

Lodash docs show _.isTypedArray([]) as false—the bracket-literal array isn't a TypedArray.

javascript
import isTypedArray from "lodash/isTypedArray";

console.log(
  "arr: " + isTypedArray([1, 2, 3]) + "\n" + // false (lodash docs)
  "obj: " + isTypedArray({ length: 3 }) + "\n" + // false
  "nullVal: " + isTypedArray(null)            // false
);
Try it Yourself

📋 _.isTypedArray vs related checks

API / patternBehavior
_.isTypedArray(x)Any native TypedArray view.
Array.isArray(x)Plain JS arrays only—TypedArrays fail.
_.isArrayBuffer(x)Detects the raw buffer; not a TypedArray.
ArrayBuffer.isView(x)Includes TypedArrays and DataView—a broader check.

Pitfalls to avoid

Buffer

Node.js Buffer

In Node, Buffer.from(...) is a subclass of Uint8Array, so it does pass this check.

Views

Shared backing buffer

Two TypedArrays can share an ArrayBuffer; both pass the check but mutating one is visible to the other.

Subclass

Custom subclasses

Classes extending a TypedArray inherit the internal tag and still register as TypedArrays.

❓ FAQ

Any view over an ArrayBuffer: Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, and Float64Array.
ArrayBuffer is the underlying raw byte storage; TypedArrays are typed views over it. Use _.isArrayBuffer for the buffer itself.
No. DataView is a flexible byte-level accessor over an ArrayBuffer, but it isn't classified as a TypedArray.
No. Array.isArray returns false for TypedArrays even though they are indexable—they have a different internal slot.

Summary

  • Purpose: guarantee a value is a TypedArray view before binary-safe operations.
  • Remember: ArrayBuffer, DataView, and ordinary arrays all return false.
  • Next: explore more on Lodash _.isUndefined().
Did you know?

_.isTypedArray recognizes every native TypedArray view—Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, and Float64Array—but neither ArrayBuffer nor DataView qualify.

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.

6 people found this page helpful