chore: replace for ... in with Array.reduce (#3149)

This commit is contained in:
David Wheatley 2021-11-04 00:21:47 +01:00 committed by GitHub
parent ef9db0655a
commit d5ac76fbf4

View File

@ -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',