summaryrefslogtreecommitdiff
path: root/lib/path.ts
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2019-03-02 02:49:39 -0800
committerNick Van Doorn <vandoorn.nick@gmail.com>2019-03-02 02:49:39 -0800
commit438b369d5efdfdf8e7ea3b70540f5e7cf9929e93 (patch)
tree7a4e86146c79d64e8c8e35db37ea2824eafae07b /lib/path.ts
parentcc3c82a0b2816a4e1601d237a130cf7bae953335 (diff)
Let\'s try again
Diffstat (limited to 'lib/path.ts')
-rw-r--r--lib/path.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/path.ts b/lib/path.ts
new file mode 100644
index 0000000..ab2bb1c
--- /dev/null
+++ b/lib/path.ts
@@ -0,0 +1,7 @@
+export const encodePath = (path: string): string =>
+ path
+ .split('/')
+ .filter((k: string) => k)
+ .join('%2F') // encode the '/' char for the url
+
+export const decodePath = (path: string): string => `/${path}`