Make _.where iterate over only own properties.

Former-commit-id: 29b4cafe5271cad70c711c2d401cea627fa97e33
This commit is contained in:
John-David Dalton
2012-11-11 20:00:20 -08:00
parent ed66ff88a1
commit f6d28a90e3
4 changed files with 37 additions and 15 deletions

View File

@@ -2537,10 +2537,7 @@
* // => [{ 'name': 'moe', 'age': 40 }]
*/
function where(collection, properties) {
var props = [];
forIn(properties, function(value, prop) {
props.push(prop);
});
var props = keys(properties);
return filter(collection, function(object) {
var length = props.length;
while (length--) {