From fa4b1a58f3e393d00e05efae24a668d2cee6afbe Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 1 May 2023 21:33:21 +0300 Subject: [PATCH] Create url.js --- scripts/core/url.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 scripts/core/url.js diff --git a/scripts/core/url.js b/scripts/core/url.js new file mode 100644 index 000000000..939e42493 --- /dev/null +++ b/scripts/core/url.js @@ -0,0 +1,11 @@ +const normalize = require('normalize-url') + +const url = {} + +url.normalize = function (string) { + const normalized = normalize(string, { stripWWW: false }) + + return decodeURIComponent(normalized).replace(/\s/g, '+') +} + +module.exports = url