Function isMatchWith

  • This method is like isMatch except that it accepts customizer which is invoked to compare values. If customizer returns undefined, comparisons are handled by the method instead. The customizer is invoked with five arguments: (objValue, srcValue, index|key, object, source).

    Type Parameters

    • V1

    • V2


    • object: V1

      The object to inspect.

    • source: V2

      The object of property values to match.

    • customizer: ((v1?, v2?) => boolean)

      The function to customize comparisons.

        • (v1?, v2?): boolean
        • Parameters

          • Optional v1: V1
          • Optional v2: V2

          Returns boolean

    Returns boolean

    Returns true if object is a match, else false.




    function isGreeting(value) {
    return /^h(?:i|ello)$/.test(value)

    function customizer(objValue, srcValue) {
    if (isGreeting(objValue) && isGreeting(srcValue)) {
    return true

    const object = { 'greeting': 'hello' }
    const source = { 'greeting': 'hi' }

    isMatchWith(object, source, customizer)
    // => true