diff options
Diffstat (limited to 'source/blog.js')
| -rw-r--r-- | source/blog.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blog.js b/source/blog.js index 8e0922f..a45267e 100644 --- a/source/blog.js +++ b/source/blog.js @@ -57,10 +57,21 @@ class Blog { }) } }) - res(this.blog) + res(this.#OrderByDate(this.blog)) }) }) } + + #OrderByDate(x) { + const entries =[] + x.forEach((value, key) => {entries.push([key, value])}) + entries.sort((a, b) => { + const dateA = b[1].date + const dateB = a[1].date + return dateA - dateB + }) + return new Map(entries) + } } module.exports = () => {return new Blog()} |
