File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @curiousleaf/utils" ,
33 "description" : " A lightweight set of utilities" ,
4- "version" : " 1.0.36 " ,
4+ "version" : " 1.0.37 " ,
55 "license" : " MIT" ,
66 "author" : {
77 "name" : " Piotr Kulpinski" ,
Original file line number Diff line number Diff line change @@ -45,9 +45,7 @@ export const isExternalLink = (url?: string): boolean => {
4545 * @param url The URL to be stripped.
4646 * @returns The URL with the subpath removed.
4747 */
48- export const stripURLSubpath = ( url ?: string ) => {
49- if ( ! url ) return url
50-
48+ export const stripURLSubpath = ( url : string ) => {
5149 try {
5250 const parsedUrl = new URL ( url )
5351 return `${ parsedUrl . protocol } //${ parsedUrl . host } `
@@ -64,7 +62,7 @@ export const stripURLSubpath = (url?: string) => {
6462 */
6563export const getUrlHostname = ( url : string ) => {
6664 if ( isValidUrl ( url ) ) {
67- return new URL ( url ) . hostname
65+ return new URL ( url ) . hostname . replace ( "www." , "" )
6866 }
6967
7068 return url
You can’t perform that action at this time.
0 commit comments