diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-01-19 22:05:55 -0800 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-01-19 22:05:55 -0800 |
commit | d590774f2a8cef0f8287e469df0960f0724cdd5a (patch) | |
tree | 04c5480f3b51f81a49d62f2b50f1615339ccb2b7 | |
parent | 84aa80496ea4d7f54306cca38674d9b7cacaae0a (diff) |
Improve docs
-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]; |