mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-22 19:05:41 +00:00
Converted getAllArticles to TypeScript
This commit is contained in:
parent
f7f6841e72
commit
28fbd0f6c2
@ -1,7 +1,7 @@
|
|||||||
import glob from 'fast-glob'
|
import glob from 'fast-glob'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
async function importArticle(articleFilename) {
|
async function importArticle(articleFilename: string) {
|
||||||
let {meta, default: component} = await import(
|
let {meta, default: component} = await import(
|
||||||
`../pages/writing/${articleFilename}`
|
`../pages/writing/${articleFilename}`
|
||||||
)
|
)
|
||||||
@ -19,5 +19,5 @@ export async function getAllArticles() {
|
|||||||
|
|
||||||
let articles = await Promise.all(articleFilenames.map(importArticle))
|
let articles = await Promise.all(articleFilenames.map(importArticle))
|
||||||
|
|
||||||
return articles.sort((a, z) => new Date(z.date) - new Date(a.date))
|
return articles.sort((a, z) => a.date < z.date ? 1 : -1)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user