Added URL util to repo.
This commit is contained in:
15
src/utils/url.js
Normal file
15
src/utils/url.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
function stripQuery(url) {
|
||||||
|
if (!url) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { origin, pathname } = new URL(url);
|
||||||
|
|
||||||
|
return `${origin}${pathname}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
stripQuery,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user