Sunday, November 16, 2025
HomeLanguagesJavascriptLodash _.isMatchWith() Method

Lodash _.isMatchWith() Method

The Lodash _.isMatchWith() Method performs a partial deep comparison between object and source to determine if the object contains equivalent property values. Due to partial comparisons, it will match empty array and empty object source values against any array or object value, respectively. This method accepts another function as “customizer” which is invoked to compare values.

Syntax:

_.isMatchWith( object, source, [customizer] )

Parameters: This method accepts three parameters as mentioned above and described below:

  • object: Object in which source is to be matched.
  • source: Source which is to be matched.
  • customizer: Function used to customize comparisons.

Return Value: This method returns a boolean value. Returns true if the source and the given object matches, else false.

Example 1: 

Javascript




      
// Defining Lodash variable 
const _ = require('lodash'); 
  
var object = { 'Geeks': "GfG", 'Geeks2': "GfG2" };
  
function fun() {
    return true;
}
  
// Checking
console.log(_.isMatch(object, { 'Geeks2': "GfG2" }, fun)); 
  
// Checking
console.log(_.isMatch(object, { 'Geeks': "GfG2" }, fun)); 


Output:

true
false

Example 2: For checking with an empty source this method returns true.

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
var object = { 'Geeks': "GfG", 'Geeks2': "GfG2" };
  
function fun(){
    return true;
}
  
// Checking
console.log(_.isMatch(object, { }, fun)); 


Output:

true
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32402 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6768 POSTS0 COMMENTS
Nicole Veronica
11919 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11990 POSTS0 COMMENTS
Shaida Kate Naidoo
6897 POSTS0 COMMENTS
Ted Musemwa
7149 POSTS0 COMMENTS
Thapelo Manthata
6850 POSTS0 COMMENTS
Umr Jansen
6841 POSTS0 COMMENTS