mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 04:33:47 +08:00
chore: replace for ... in
with Array.reduce
(#3149)
This commit is contained in:
parent
ef9db0655a
commit
d5ac76fbf4
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue
Block a user