diff --git a/src/utils/url.js b/src/utils/url.js new file mode 100644 index 00000000..66e61309 --- /dev/null +++ b/src/utils/url.js @@ -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, +};