mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Bump to v3.2.0.
This commit is contained in:
@@ -5,6 +5,11 @@ define(['../internal/baseClone', '../internal/baseMatches'], function(baseClone,
|
||||
* and `source`, returning `true` if the given object has equivalent property
|
||||
* values, else `false`.
|
||||
*
|
||||
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
||||
* numbers, `Object` objects, regexes, and strings. Objects are compared by
|
||||
* their own, not inherited, enumerable properties. For comparing a single
|
||||
* own or inherited property value see `_.matchesProperty`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utility
|
||||
@@ -13,17 +18,12 @@ define(['../internal/baseClone', '../internal/baseMatches'], function(baseClone,
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'fred', 'age': 40 },
|
||||
* { 'user': 'barney', 'age': 36 }
|
||||
* { 'user': 'barney', 'age': 36, 'active': true },
|
||||
* { 'user': 'fred', 'age': 40, 'active': false }
|
||||
* ];
|
||||
*
|
||||
* var matchesAge = _.matches({ 'age': 36 });
|
||||
*
|
||||
* _.filter(users, matchesAge);
|
||||
* // => [{ 'user': 'barney', 'age': 36 }]
|
||||
*
|
||||
* _.find(users, matchesAge);
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
* _.filter(users, _.matches({ 'age': 40, 'active': false }));
|
||||
* // => [{ 'user': 'fred', 'age': 40, 'active': false }]
|
||||
*/
|
||||
function matches(source) {
|
||||
return baseMatches(baseClone(source, true));
|
||||
|
||||
Reference in New Issue
Block a user