Latest
function default
import { default } from "https://dotland.deno.dev/x/lodash_es@v0.0.2/src/matchesProperty.js";

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.

Note: Multiple values can be checked by combining several matchers using _.overSome

Examples

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

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

// Checking for several possible values _.filter(objects, .overSome([.matchesProperty('a', 1), _.matchesProperty('a', 4)])); // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]

Parameters

path

The path of the property to get.

srcValue

The value to match.