diff options
-rw-r--r-- | src/database.ts | 7 | ||||
-rw-r--r-- | src/util.ts | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/database.ts b/src/database.ts index 35ffc0f..2ea707b 100644 --- a/src/database.ts +++ b/src/database.ts @@ -7,7 +7,14 @@ import { NaiveError, NaiveErrorCode as e } from "./error.model"; import { last } from "./util"; +/** + * Split path using "/" as a delimiter + */ const splitPath = (path: string): string[] => path.split("/").filter(k => k); + +/** + * Identify if a path is a root node + */ const isRootNode = (path: string): boolean => path === "/" || path === ""; const write = promisify(writeFile); diff --git a/src/util.ts b/src/util.ts index 7b14d52..abbf44d 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1 +1,4 @@ +/** + * Get the last item in t + */ export const last = <T>(t: T[]): T => t[t.length - 1]; |