diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-01-28 11:55:03 +0100 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-01-28 11:55:03 +0100 |
commit | 9f75ff1d2d5ebf34c040474e836e125f80253365 (patch) | |
tree | 523c52b9dd158e21d9247b58d81c655102323a26 /lib/utils.ts | |
parent | c11d7a84aa59e9b1179a9834129b2d776bab8bca (diff) | |
download | kronikarz-9f75ff1d2d5ebf34c040474e836e125f80253365.tar.gz kronikarz-9f75ff1d2d5ebf34c040474e836e125f80253365.zip |
Add Post class
Diffstat (limited to 'lib/utils.ts')
-rw-r--r-- | lib/utils.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/utils.ts b/lib/utils.ts index 23a3947..f75c0e4 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,4 +1,6 @@ import * as fs from "fs"; +import { Date } from './interfaces'; +import Post from './Post' export function readDir(path: string): Array<string> { if (fs.existsSync(path)) { @@ -7,3 +9,15 @@ export function readDir(path: string): Array<string> { throw `Path "${path}" doesn't exist`; } } + +export function sortPosts(posts: Array<Post>): Array<Post> { + return posts; +} + +export function dateToString({ year, month, day }: Date): string { + return `${year}-${month}-${day}` +} + +export function dateToPath({ year, month, day }: Date): string { + return `${year}/${month}/${day}` +} |