From 9f75ff1d2d5ebf34c040474e836e125f80253365 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Tue, 28 Jan 2020 11:55:03 +0100 Subject: Add Post class --- lib/utils.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/utils.ts') 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 { if (fs.existsSync(path)) { @@ -7,3 +9,15 @@ export function readDir(path: string): Array { throw `Path "${path}" doesn't exist`; } } + +export function sortPosts(posts: Array): Array { + 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}` +} -- cgit 1.4.1