mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Ensure pluck always used property and findWhere and where always use matches.
This commit is contained in:
@@ -3994,7 +3994,7 @@
|
|||||||
* // => { 'name': 'fred', 'age': 40, 'employer': 'slate' }
|
* // => { 'name': 'fred', 'age': 40, 'employer': 'slate' }
|
||||||
*/
|
*/
|
||||||
function findWhere(collection, source) {
|
function findWhere(collection, source) {
|
||||||
return find(collection, Object(source));
|
return find(collection, matches(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4431,7 +4431,6 @@
|
|||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @type Function
|
|
||||||
* @category Collections
|
* @category Collections
|
||||||
* @param {Array|Object|string} collection The collection to iterate over.
|
* @param {Array|Object|string} collection The collection to iterate over.
|
||||||
* @param {string} key The name of the property to pluck.
|
* @param {string} key The name of the property to pluck.
|
||||||
@@ -4446,7 +4445,9 @@
|
|||||||
* _.pluck(characters, 'name');
|
* _.pluck(characters, 'name');
|
||||||
* // => ['barney', 'fred']
|
* // => ['barney', 'fred']
|
||||||
*/
|
*/
|
||||||
var pluck = map;
|
function pluck(collection, key) {
|
||||||
|
return map(collection, property(key));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduces a collection to a value which is the accumulated result of running
|
* Reduces a collection to a value which is the accumulated result of running
|
||||||
@@ -4858,7 +4859,7 @@
|
|||||||
* // => ['barney', 'fred']
|
* // => ['barney', 'fred']
|
||||||
*/
|
*/
|
||||||
function where(collection, source) {
|
function where(collection, source) {
|
||||||
return filter(collection, Object(source));
|
return filter(collection, matches(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user