File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const parts: Record<string, (url: URL) => string> = {
7
7
protocol : x => x . protocol ,
8
8
search : x => x . search ,
9
9
hash : x => x . hash ,
10
+ filename : x => x . pathname . split ( "/" ) . pop ( ) ?? "" ,
10
11
all : getAllParts ,
11
12
} ;
12
13
@@ -34,6 +35,10 @@ export default glide
34
35
. withTest ( { uri : "https://www.glideapps.com/blog" , part : "pathname" } , "/blog" )
35
36
. withTest ( { uri : "https://www.glideapps.com?message=hello%20world" , part : "message" } , "hello world" )
36
37
38
+ . withTest ( { uri : "https://www.glideapps.com/blog/post/123" , part : "filename" } , "123" )
39
+ . withTest ( { uri : "https://www.glideapps.com/blog/post/123.pdf" , part : "filename" } , "123.pdf" )
40
+ . withTest ( { uri : "https://www.glideapps.com/blog/post/123.pdf?message=hello%20world" , part : "filename" } , "123.pdf" )
41
+
37
42
. run ( ( { uri, part = "all" } ) => {
38
43
try {
39
44
const url = new URL ( uri ) ;
You can’t perform that action at this time.
0 commit comments