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

    Parameters

    • object: V1

      The object to inspect.

    • source: V2

      The object of property values to match.

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

      The function to customize comparisons.

    Returns boolean

    Returns true if object is a match, else false.

    5.10.0

    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