From 5baad4df101599af5b4c80df210b0581651ddedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipi=C5=84ski?= Date: Tue, 21 Feb 2017 10:40:51 +0100 Subject: [PATCH] Missing iteratee call in `groupBy` and `keyBy`. --- groupBy.js | 1 + keyBy.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/groupBy.js b/groupBy.js index 51c109df98..03b5ea557f 100644 --- a/groupBy.js +++ b/groupBy.js @@ -23,6 +23,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty */ function groupBy(collection, iteratee) { return reduce(collection, (result, value, key) => { + key = iteratee(value) if (hasOwnProperty.call(result, key)) { result[key].push(value) } else { diff --git a/keyBy.js b/keyBy.js index d5afc8edad..2297565bb7 100644 --- a/keyBy.js +++ b/keyBy.js @@ -25,7 +25,7 @@ import reduce from './reduce.js' */ function keyBy(collection, iteratee) { return reduce(collection, (result, value, key) => ( - baseAssignValue(result, key, value), result + baseAssignValue(result, iteratee(value), value), result ), {}) }