Ensure pluck always used property and findWhere and where always use matches.

This commit is contained in:
John-David Dalton
2014-04-15 22:40:26 -07:00
parent 75c3939c88
commit 34133b094b

View File

@@ -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));
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/