add URL cleaning external function

This commit is contained in:
buzz-lightsnack-2007 2024-05-05 23:00:09 +08:00
parent 2a7c2fc750
commit 42cea844a8

16
scripts/utils/URLs.js Normal file
View file

@ -0,0 +1,16 @@
/*
URL tools
*/
class URLs {
/*
Remove the protocol from the URL.
@param {string} URL the URL to clean
*/
static clean(URL) {
return((URL.trim().replace(/(^\w+:|^)\/\//, ``).split(`?`))[0]);
}
}
export {URLs};