summary refs log tree commit diff
path: root/lib/utils.ts
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-01-28 18:16:03 +0100
committerGitHub <noreply@github.com>2020-01-28 18:16:03 +0100
commit42c089293fed2db9c8a09d8e55f046169b5f0844 (patch)
tree18a053fe7f1e03fc5419a8c3d2a8bc8193cb27f0 /lib/utils.ts
parent7b8d75cd87e392d9ffb3defa538a041c4f7e0f0c (diff)
parentacfd4d0c722ceeca6aad51be64baf117e73f286c (diff)
downloadkronikarz-42c089293fed2db9c8a09d8e55f046169b5f0844.tar.gz
kronikarz-42c089293fed2db9c8a09d8e55f046169b5f0844.zip
Merge pull request #8 from pniedzwiedzinski/feature/generateApi v2.0
Feature/generate api
Diffstat (limited to 'lib/utils.ts')
-rw-r--r--lib/utils.ts14
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}`
+}