From 4dee7596745a8ae0fcbeb296aede10da86e2638d Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 16 Dec 2021 17:09:00 -0500 Subject: [PATCH] docs: add groupBy helper doc comment --- ui/desktop/app/helpers/group-by.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/desktop/app/helpers/group-by.js b/ui/desktop/app/helpers/group-by.js index d747eaacd..f88b4aa84 100644 --- a/ui/desktop/app/helpers/group-by.js +++ b/ui/desktop/app/helpers/group-by.js @@ -11,6 +11,13 @@ const groupByReducer = (items, key) => { return arr; }; +/** + * This helper accepts an array of objects and groups them by a specified key. + * It returns a new array of objects in the form [{ key, items }], where `key` + * is the value of the specified key and `items` is an array of matching items. + * @param {object[]} items + * @param {string} key + */ export default helper(function groupBy([items, key]) { const result = groupByReducer(items, key); return result;