Options
All
  • Public
  • Public/Protected
  • All
Menu

Module isMatchWith

Index

References

Functions Lang

References

Renames and re-exports isMatchWith

Lang Functions

  • isMatchWith<V1, V2>(object: V1, source: V2, customizer: (v1?: V1, v2?: V2) => boolean): boolean
  • 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).

    since

    5.10.0

    example
    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

    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.

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

          • Optional v1: V1
          • Optional v2: V2

          Returns boolean

    Returns boolean

    Returns true if object is a match, else false.