From 34133b094b8687a5b6cab1d23876df8a78a51ee4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 15 Apr 2014 22:40:26 -0700 Subject: [PATCH] Ensure `pluck` always used `property` and `findWhere` and `where` always use `matches`. --- lodash.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lodash.js b/lodash.js index 06ff18443..b301cfe5d 100644 --- a/lodash.js +++ b/lodash.js @@ -3994,7 +3994,7 @@ * // => { 'name': 'fred', 'age': 40, 'employer': 'slate' } */ function findWhere(collection, source) { - return find(collection, Object(source)); + return find(collection, matches(source)); } /** @@ -4431,7 +4431,6 @@ * * @static * @memberOf _ - * @type Function * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {string} key The name of the property to pluck. @@ -4446,7 +4445,9 @@ * _.pluck(characters, 'name'); * // => ['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 @@ -4858,7 +4859,7 @@ * // => ['barney', 'fred'] */ function where(collection, source) { - return filter(collection, Object(source)); + return filter(collection, matches(source)); } /*--------------------------------------------------------------------------*/