extractHttpEndpoint
Script
v2
Fork
1
2
3
4
5
6
export
function
extractHttpEndpoint
(
url
:
string
|
URL
)
{
const
{
pathname
}
=
new
URL
(
url
)
;
const
[
author
,
filename
]
=
pathname
.
split
(
"/"
)
.
slice
(
-
2
)
;
const
[
name
]
=
filename
.
split
(
"."
)
;
return
`https://
${
author
}
-
${
name
}
.web.val.run`
;
}