Lodash _.isMatch() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Performs a partial deep comparison between object and source to see if object contains equivalent property values. Part of Lodash Lang since 3.0.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 _.isMatch. Start with this line.

Lodash
_.isMatch(object, source)
CallWhat it does
_.isMatch(object, source)Primary signature.
_.isMatch(value)Check, compare, clone, or convert a value.

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

Library declarations
Lodash
_.isMatch(object, source)

Parameters

ParameterDescription
objectRequired. The object to inspect
sourceRequired. Property values that must match

Return Value

Return ValueDescription
*true if object matches source, else false

Lodash Examples

Example 1 — Official: Matching Source

When the required source property matches, the result is true.

Lodash
var object = { 'a': 1, 'b': 2 };

_.isMatch(object, { 'b': 2 });
// → true
Try It Yourself

How It Works

  1. Object. { a: 1, b: 2 } is the value to inspect.
  2. Source. Only b: 2 is required.
  3. Compare. object.b equals 2.
  4. Result. true — key a is ignored.

Example 2 — Official: Wrong Value

If a source property exists but differs, the match fails.

Lodash
var object = { 'a': 1, 'b': 2 };

_.isMatch(object, { 'b': 1 });
// → false
Try It Yourself

How It Works

  1. Source asks for b: 1.
  2. Object has b: 2.
  3. Not equivalent. Partial match fails.
  4. Result. false.

Example 3 — Nested Partial Match

Nested objects are compared deeply for the paths in source.

Lodash
var object = { a: 1, b: { c: 2, d: 3 } };

_.isMatch(object, { b: { c: 2 } });
// → true

_.isMatch(object, { b: { c: 9 } });
// → false
Try It Yourself

How It Works

  1. Source. Requires nested b.c === 2.
  2. Deep check. Lodash walks into object.b.
  3. Sibling keys. Nested d may remain unmatched — that is fine.
  4. Wrong nested value. c: 9 fails the match.

Example 4 — Empty Source Matches

Empty {} / [] sources match any object / array value.

Lodash
_.isMatch({ a: 1 }, {});
// → true

_.isMatch([1, 2, 3], []);
// → true

_.isMatch({ a: 1 }, { a: 1, b: 2 });
// → false  // missing b on object
Try It Yourself

How It Works

  1. Empty object. No required keys → always a match for objects.
  2. Empty array. Same idea for arrays.
  3. Direction. Source keys must exist on the object, not the other way around.
  4. Docs note. This is intentional partial-comparison behavior.

Example 5 — isMatch vs isEqual

Extra keys fail full equality, but pass a partial match.

Lodash
var object = { a: 1, b: 2 };
var source = { b: 2 };

_.isMatch(object, source);   // → true
_.isEqual(object, source);   // → false

// filter-style: _.filter(users, _.matches({ active: true }))
Try It Yourself

How It Works

  1. isMatch. Only checks b: 2 → true.
  2. isEqual. Structures differ (a missing on source) → false.
  3. Use case. Filtering lists by a subset of fields.
  4. Related. _.matches(source) builds that predicate for you.

Browser & Runtime Support

_.isMatch is a Lodash Lang helper (available since 3.0.0, stable in 4.x). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 3.0.0+

_.isMatch()

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

100% With Lodash 4.x
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
_.isMatch Lodash 3.0.0+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import isMatch from "lodash/isMatch" for smaller builds. For reusable filters, prefer _.matches(source).

Frequently Asked Questions

_.isMatch(object, source) performs a partial deep comparison and returns true when object contains equivalent property values for every key in source. Extra keys in object are ignored.
_.isEqual requires full structural equality both ways. _.isMatch only checks that source is a subset match of object.
An empty object or empty array as source matches any object or array value respectively. That is intentional partial-comparison behavior.
Yes. Lodash documents that _.isMatch is equivalent to _.matches when source is partially applied — useful as a filter predicate.
Yes. Nested objects and arrays are compared deeply using the same equivalence rules as _.isEqual for the paths present in source.
Use import isMatch from "lodash/isMatch" or require("lodash/isMatch"). Full build: import _ from "lodash" then _.isMatch.

Next: _.isMatchWith()

Partial deep comparison with a customizer for special equality rules.

_.isMatchWith() tutorial →

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