Skip to content

Commit

Permalink
prefer Array#toSorted over Array#sort
Browse files Browse the repository at this point in the history
  • Loading branch information
yuheiy committed Oct 24, 2023
1 parent 8527dae commit 5a07489
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const title = 'ウェブサイト構築のためのモダンなフロントエ
const description =
'sdenvは、ウェブアプリケーションではなくウェブサイトを開発するためのベストプラクティスに基づいて構成されたフロントエンド開発環境です。やりすぎないちょうどいい使い勝手の実現を念頭に置いて設計されている、より多くのウェブサイト開発者のためのツールキットです。';
const newsEntries = (await getCollection('news')).sort(
const newsEntries = (await getCollection('news')).toSorted(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
---
Expand Down
2 changes: 1 addition & 1 deletion src/pages/news/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Layout from '@/layouts/Layout.astro';
const title = 'お知らせ';
const description = '';
const newsEntries = (await getCollection('news')).sort(
const newsEntries = (await getCollection('news')).toSorted(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
---
Expand Down
2 changes: 1 addition & 1 deletion src/pages/work/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Layout from '@/layouts/Layout.astro';
const title = '実績';
const description = '';
const workEntries = (await getCollection('work')).sort(
const workEntries = (await getCollection('work')).toSorted(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
---
Expand Down

0 comments on commit 5a07489

Please sign in to comment.