summaryrefslogtreecommitdiff
path: root/lib/path.ts
diff options
context:
space:
mode:
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}`