Module

x/lodash_es/src/util.js>matches

lodash for deno use
Latest
function matches
import { matches } from "https://dotland.deno.dev/x/lodash_es@v0.0.2/src/util.js";

Creates a function that performs a partial deep comparison between a given object and source, returning true if the given object has equivalent property values, else false.

Note: The created function is equivalent to _.isMatch with source partially applied.

Partial comparisons will match empty array and empty object source 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 } ];

_.filter(objects, _.matches({ 'a': 4, 'c': 6 })); // => [{ 'a': 4, 'b': 5, 'c': 6 }]

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

Parameters

source

The object of property values to match.