Skip to content

Commit

Permalink
refactor: simplify lunr_index helper
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Oct 12, 2019
1 parent dce5637 commit 2faf5d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ hexo.extend.helper.register('lunr_index', function(data) {
};
};

data.concat().sort(sortBy('name')).forEach((item, i) => {
data.concat().sort((a, b) => {
if (a.name > b.name) {
return 1;
} else if (b.name > a.name) {
return -1;
}
return 0;
}).forEach((item, i) => {
const object = Object.assign({}, { id: i }, item);
this.add(object);
});
Expand Down

0 comments on commit 2faf5d7

Please sign in to comment.