Creates a predicate that compares the value at a path on an object to a fixed srcValue — true when they are equivalent (deep compare). Part of Lodash Util since 3.2.0 (stable — not deprecated).
Note: The iteratee shorthand is a two-element array [path, value] — same rules as calling _.matchesProperty(path, value).
Syntax
Call _.matchesProperty. Start with this line.
Lodash
_.matchesProperty(path, srcValue)
Call
What it does
_.matchesProperty(path, srcValue)
Primary signature.
_.matchesProperty(...)
Call the util helper.
Prefer import matchesProperty from "lodash/matchesProperty" when you want a smaller bundle.
Library declarations
Lodash
_.matchesProperty(path, srcValue)
Parameters
Parameter
Description
path
Required. String or array path to read
srcValue
Required. Value to compare at that path
Return Value
Return Value
Description
*
Predicate (object) → boolean
Lodash Examples
Example 1 — Official: Find by Path Value
Find the first object whose path equals the expected value.
OR helper._.overSome succeeds if any matcher passes.
Both rows. Each object hits one branch.
Use. Official pattern for several possible values on one path.
Compatibility
Browser & Runtime Support
_.matchesProperty is a Lodash Util helper since 3.2.0. It runs anywhere Lodash 3.2+ / 4.x runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 3.2.0+
_.matchesProperty()
Available in [email protected] full builds and the lodash/matchesProperty modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 3.2+
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
_.matchesPropertyLodash 3.2.0+
Bottom line: Safe for production once Lodash is loaded. Prefer import matchesProperty from "lodash/matchesProperty" for smaller bundles. Collection methods already accept [path, value] shorthands with the same rules.
Frequently Asked Questions
_.matchesProperty(path, srcValue) returns a predicate. For each object it reads the value at path (Lodash get-style) and deeply compares it to srcValue. Returns true when they match.
A string like 'a' or 'user.name', or an array of keys like ['user', 'name']. Same path forms as _.get / _.property.
_.matches({ a: 4, c: 6 }) checks multiple keys with a source object. _.matchesProperty('a', 4) checks one path against one value.
_.find(arr, ['a', 4]) uses the same rules as _.find(arr, _.matchesProperty('a', 4)). The two-element array is the iteratee shorthand.
_.property('a') returns a getter that plucks the value. _.matchesProperty('a', 4) returns a predicate that is true only when that value equals 4.
Yes. Official note: empty object and empty array srcValue values match any object or array at that path. Be careful with {} or [] as the expected value.