From 1681d250635d099fe2d7d88e275322eecb0699af Mon Sep 17 00:00:00 2001 From: Andrei Date: Thu, 5 May 2011 14:43:28 -0400 Subject: [PATCH] in groupBy, also pass index to iterator. --- underscore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/underscore.js b/underscore.js index cbcd476e4..a0ad75eec 100644 --- a/underscore.js +++ b/underscore.js @@ -254,8 +254,8 @@ // Groups the object's values by a criterion produced by an iterator _.groupBy = function(obj, iterator) { var result = {}; - each(obj, function(value) { - var key = iterator(value); + each(obj, function(value, index) { + var key = iterator(value, index); (result[key] || (result[key] = [])).push(value) }); return result;