File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const parts: Record<string, (url: URL) => string> = {
77 protocol : x => x . protocol ,
88 search : x => x . search ,
99 hash : x => x . hash ,
10+ filename : x => x . pathname . split ( "/" ) . pop ( ) ?? "" ,
1011 all : getAllParts ,
1112} ;
1213
@@ -34,6 +35,10 @@ export default glide
3435 . withTest ( { uri : "https://www.glideapps.com/blog" , part : "pathname" } , "/blog" )
3536 . withTest ( { uri : "https://www.glideapps.com?message=hello%20world" , part : "message" } , "hello world" )
3637
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+
3742 . run ( ( { uri, part = "all" } ) => {
3843 try {
3944 const url = new URL ( uri ) ;
You can’t perform that action at this time.
0 commit comments