From d5ac76fbf46a03236de63f2133ad34a9f6d7d118 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Thu, 4 Nov 2021 00:21:47 +0100 Subject: [PATCH] chore: replace `for ... in` with `Array.reduce` (#3149) --- framework/core/js/src/forum/components/IndexPage.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/core/js/src/forum/components/IndexPage.js b/framework/core/js/src/forum/components/IndexPage.js index 4be63fad8..157242016 100644 --- a/framework/core/js/src/forum/components/IndexPage.js +++ b/framework/core/js/src/forum/components/IndexPage.js @@ -219,10 +219,10 @@ export default class IndexPage extends Page { const items = new ItemList(); const sortMap = app.discussions.sortMap(); - const sortOptions = {}; - for (const i in sortMap) { - sortOptions[i] = app.translator.trans('core.forum.index_sort.' + i + '_button'); - } + const sortOptions = Object.keys(sortMap).reduce((acc, sortId) => { + acc[sortId] = app.translator.trans(`core.forum.index_sort.${sortId}_button`); + return acc; + }, {}); items.add( 'sort',