Lodash _.isObjectLike() method

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

What you’ll learn

  • How _.isObjectLike(value) narrows values to non-nullish typeof object.
  • Why functions fail here while passing _.isObject.
  • Which builtins qualify (arrays, dates, regexes, boxed numbers).
  • When to tighten checks with _.isPlainObject or explicit tags.

Prerequisites

You completed or skimmed the _.isObject lesson—this helper is the tighter sibling.

  • You remember typeof null === "object" but lodash filters nullish values first.
  • Try-it labs load lodash from the CDN.

Overview

Use _.isObjectLike inside lodash internals and application guards when you want structural objects—excluding callables—before running tag-based helpers such as string coercions or cloned iterators.

Structural focus

Keeps arrays, plain records, and host objects that typeof as object.

Functions out

Callables use typeof function—automatically excluded.

Still broad

Follow up with _.isPlainObject when only POJOs qualify.

Syntax

javascript
_.isObjectLike(value)
  • value: any value to test.
  • Returns: true when value is not null/undefined and typeof value === "object".
1

Plain objects and arrays

Matches lodash documentation patterns for everyday collections.

javascript
import isObjectLike from "lodash/isObjectLike";

console.log(
  "pojo: " + isObjectLike({}) + "\n" +              // true
  "array: " + isObjectLike([1, 2, 3])             // true
);
Try it Yourself
2

Nullish guards

null fails despite the historic typeof null === "object" bug—lodash filters first.

javascript
import isObjectLike from "lodash/isObjectLike";

console.log(
  "nullVal: " + isObjectLike(null) + "\n" +       // false (lodash docs)
  "undef: " + isObjectLike(undefined)           // false
);
Try it Yourself
3

Functions: unlike _.isObject

Lodash docs contrast _.isObjectLike(_.noop) returning false—pair with _.isObject for the dual.

javascript
import isObjectLike from "lodash/isObjectLike";
import isObject from "lodash/isObject";

console.log(
  "fnLike: " + isObjectLike(function () {}) + "\n" + // false (lodash docs)
  "fnObject: " + isObject(function () {})           // true
);
Try it Yourself

📋 _.isObjectLike vs related helpers

APIBehavior
_.isObjectLike(x)Non-nullish and typeof === "object".
_.isObject(x)Also allows typeof === "function".
_.isPlainObject(x)Subset—simple dictionaries only.
Array.isArray(x)Arrays only—stricter than object-like.

Pitfalls to avoid

DOM

Elements qualify

DOM nodes typeof object—combine with tag checks when that matters.

Boxes

Legacy wrappers

Object(5) looks like an object—unwrap if you expected primitives.

Schema

Still wide net

Validate shapes after this coarse gate.

❓ FAQ

Functions have typeof "function", not "object", so they fall outside this helper even though _.isObject treats them as object-category values.
Yes—arrays are ordinary objects with typeof "object".
Yes. Object(7) still typeof "object" even though it wraps a number.
No. isPlainObject insists on simple Object prototypes—many builtins that pass isObjectLike fail isPlainObject.

Summary

  • Purpose: detect values that behave like structural objects, excluding functions.
  • Remember: nullish values never pass—even though typeof null is quirky.
  • Next: explore more on Lodash _.isPlainObject().
Did you know?

_.isObjectLike(value) is value != null && typeof value === "object"—so callables never qualify, while boxed numbers and regex literals do.

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