Options
All
  • Public
  • Public/Protected
  • All
Menu

Module matchesProperty

Index

References

Functions Util

References

Renames and re-exports __type

Util Functions

  • matchesProperty(path: ArrayPath, srcValue: any): (object: any) => boolean
  • Creates a function that performs a partial deep comparison between the value at path of a given object to srcValue, returning true if the object value is equivalent, else false.

    Note: Partial comparisons will match empty array and empty object srcValue values against any array or object value, respectively. See isEqual for a list of supported value comparisons.

    since

    5.11.0

    example
    const objects = [
    { 'a': 1, 'b': 2, 'c': 3 },
    { 'a': 4, 'b': 5, 'c': 6 }
    ]

    find(objects, matchesProperty('a', 4))
    // => { 'a': 4, 'b': 5, 'c': 6 }

    Parameters

    • path: ArrayPath

      The path of the property to get.

    • srcValue: any

      The value to match.

    Returns (object: any) => boolean

    Returns the new spec function.

      • (object: any): boolean
      • Creates a function that performs a partial deep comparison between the value at path of a given object to srcValue, returning true if the object value is equivalent, else false.

        Note: Partial comparisons will match empty array and empty object srcValue values against any array or object value, respectively. See isEqual for a list of supported value comparisons.

        since

        5.11.0

        category

        Util

        example
        const objects = [
        { 'a': 1, 'b': 2, 'c': 3 },
        { 'a': 4, 'b': 5, 'c': 6 }
        ]

        find(objects, matchesProperty('a', 4))
        // => { 'a': 4, 'b': 5, 'c': 6 }

        Parameters

        • object: any

        Returns boolean

        Returns the new spec function.