add URL cleaning external function
This commit is contained in:
parent
2a7c2fc750
commit
42cea844a8
1 changed files with 16 additions and 0 deletions
16
scripts/utils/URLs.js
Normal file
16
scripts/utils/URLs.js
Normal 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};
|
Loading…
Add table
Add a link
Reference in a new issue