Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arcteryx/js-url

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcteryx/js-url - npm Package Compare versions

Comparing version 1.27.12 to 1.28.0

65

dist/cjs/index.js

@@ -12,5 +12,6 @@ 'use strict';

function endsWith(str, pattern) {
var d = str.length - pattern.length;
const d = str.length - pattern.length;
return d >= 0 && str.lastIndexOf(pattern) === d;
}
/**

@@ -22,10 +23,7 @@ * @brief Converts the product model to match the new PDP model URL.

*/
function modelConversionForNewPDP(model) {
var newModel = model;
let newModel = model;
if (model.indexOf(".") > 0) {
newModel = model.replace(/\./g, "-");
}
if (endsWith(newModel, "-W")) {

@@ -36,14 +34,11 @@ newModel = newModel.substr(0, newModel.lastIndexOf("-W"));

}
return newModel;
}
function querySt(ji, or) {
var hu = or ? or : window.location.search.substring(1),
gy = hu.split("&"),
ft,
i;
let hu = or ? or : window.location.search.substring(1),
gy = hu.split("&"),
ft,
i;
for (i = 0; i < gy.length; i++) {
ft = gy[i].split("=");
if (ft[0].toLowerCase() === ji.toLowerCase()) {

@@ -53,14 +48,13 @@ return ft[1];

}
return "";
}
function removeQueryStringParameter(url, key) {
var newUrl = url,
urlparts = url.split("?");
let newUrl = url,
urlparts = url.split("?");
if (urlparts.length >= 2) {
var prefix = "".concat(encodeURIComponent(key), "=");
var pars = urlparts[1].split(/[&;]/g); // Reverse iteration as may be destructive
const prefix = `${encodeURIComponent(key)}=`;
const pars = urlparts[1].split(/[&;]/g);
for (var i = pars.length; i-- > 0;) {
// Reverse iteration as may be destructive
for (let i = pars.length; i-- > 0;) {
// Idiom for string.startsWith

@@ -71,9 +65,8 @@ if (pars[i].lastIndexOf(prefix, 0) !== -1) {

}
newUrl = urlparts[0] + (pars.length > 0 ? "?".concat(pars.join("&")) : "");
newUrl = urlparts[0] + (pars.length > 0 ? `?${pars.join("&")}` : "");
return newUrl;
}
return newUrl;
}
/*

@@ -86,12 +79,8 @@ * Converts a simple object to query parameters

*/
function toQueryParams(obj) {
var url = Object.keys(obj).map(function (x) {
const url = Object.keys(obj).map(x => {
if (Array.isArray(obj[x])) {
return obj[x].map(function (i) {
return "".concat(encodeURIComponent(x), "=").concat(encodeURIComponent(i));
}).join("&");
return obj[x].map(i => `${encodeURIComponent(x)}=${encodeURIComponent(i)}`).join("&");
}
return "".concat(encodeURIComponent(x), "=").concat(encodeURIComponent(obj[x]));
return `${encodeURIComponent(x)}=${encodeURIComponent(obj[x])}`;
}).join("&");

@@ -101,16 +90,14 @@ return url;

function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])".concat(key, "=.*?(&|$)"), "i");
var separator = uri.indexOf("?") > -1 ? "&" : "?";
const re = new RegExp(`([?&])${key}=.*?(&|$)`, "i");
const separator = uri.indexOf("?") > -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
} // If adding country to url, add it before search
return uri.replace(re, `$1${key}=${value}$2`);
}
// If adding country to url, add it before search
if (uri.match("search=")) {
var arr = uri.split("&");
return "".concat(arr[0] + separator + key, "=").concat(value, "&").concat(arr[1]);
const arr = uri.split("&");
return `${arr[0] + separator + key}=${value}&${arr[1]}`;
}
return "".concat(uri + separator + key, "=").concat(value);
return `${uri + separator + key}=${value}`;
}

@@ -117,0 +104,0 @@

@@ -8,5 +8,6 @@ /**

function endsWith(str, pattern) {
var d = str.length - pattern.length;
const d = str.length - pattern.length;
return d >= 0 && str.lastIndexOf(pattern) === d;
}
/**

@@ -18,10 +19,7 @@ * @brief Converts the product model to match the new PDP model URL.

*/
function modelConversionForNewPDP(model) {
var newModel = model;
let newModel = model;
if (model.indexOf(".") > 0) {
newModel = model.replace(/\./g, "-");
}
if (endsWith(newModel, "-W")) {

@@ -32,14 +30,11 @@ newModel = newModel.substr(0, newModel.lastIndexOf("-W"));

}
return newModel;
}
function querySt(ji, or) {
var hu = or ? or : window.location.search.substring(1),
gy = hu.split("&"),
ft,
i;
let hu = or ? or : window.location.search.substring(1),
gy = hu.split("&"),
ft,
i;
for (i = 0; i < gy.length; i++) {
ft = gy[i].split("=");
if (ft[0].toLowerCase() === ji.toLowerCase()) {

@@ -49,14 +44,13 @@ return ft[1];

}
return "";
}
function removeQueryStringParameter(url, key) {
var newUrl = url,
urlparts = url.split("?");
let newUrl = url,
urlparts = url.split("?");
if (urlparts.length >= 2) {
var prefix = "".concat(encodeURIComponent(key), "=");
var pars = urlparts[1].split(/[&;]/g); // Reverse iteration as may be destructive
const prefix = `${encodeURIComponent(key)}=`;
const pars = urlparts[1].split(/[&;]/g);
for (var i = pars.length; i-- > 0;) {
// Reverse iteration as may be destructive
for (let i = pars.length; i-- > 0;) {
// Idiom for string.startsWith

@@ -67,9 +61,8 @@ if (pars[i].lastIndexOf(prefix, 0) !== -1) {

}
newUrl = urlparts[0] + (pars.length > 0 ? "?".concat(pars.join("&")) : "");
newUrl = urlparts[0] + (pars.length > 0 ? `?${pars.join("&")}` : "");
return newUrl;
}
return newUrl;
}
/*

@@ -82,12 +75,8 @@ * Converts a simple object to query parameters

*/
function toQueryParams(obj) {
var url = Object.keys(obj).map(function (x) {
const url = Object.keys(obj).map(x => {
if (Array.isArray(obj[x])) {
return obj[x].map(function (i) {
return "".concat(encodeURIComponent(x), "=").concat(encodeURIComponent(i));
}).join("&");
return obj[x].map(i => `${encodeURIComponent(x)}=${encodeURIComponent(i)}`).join("&");
}
return "".concat(encodeURIComponent(x), "=").concat(encodeURIComponent(obj[x]));
return `${encodeURIComponent(x)}=${encodeURIComponent(obj[x])}`;
}).join("&");

@@ -97,16 +86,14 @@ return url;

function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])".concat(key, "=.*?(&|$)"), "i");
var separator = uri.indexOf("?") > -1 ? "&" : "?";
const re = new RegExp(`([?&])${key}=.*?(&|$)`, "i");
const separator = uri.indexOf("?") > -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
} // If adding country to url, add it before search
return uri.replace(re, `$1${key}=${value}$2`);
}
// If adding country to url, add it before search
if (uri.match("search=")) {
var arr = uri.split("&");
return "".concat(arr[0] + separator + key, "=").concat(value, "&").concat(arr[1]);
const arr = uri.split("&");
return `${arr[0] + separator + key}=${value}&${arr[1]}`;
}
return "".concat(uri + separator + key, "=").concat(value);
return `${uri + separator + key}=${value}`;
}

@@ -113,0 +100,0 @@

76

dist/umd/index.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.ARCTERYX = {})));
}(this, (function (exports) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
var current = global.ARCTERYX && global.ARCTERYX.jsurl;
var exports = (global.ARCTERYX = global.ARCTERYX || {}, global.ARCTERYX.jsurl = {});
factory(exports);
exports.noConflict = function () { global.ARCTERYX.jsurl = current; return exports; };
})());
})(this, (function (exports) { 'use strict';

@@ -14,5 +19,6 @@ /**

function endsWith(str, pattern) {
var d = str.length - pattern.length;
const d = str.length - pattern.length;
return d >= 0 && str.lastIndexOf(pattern) === d;
}
/**

@@ -24,10 +30,7 @@ * @brief Converts the product model to match the new PDP model URL.

*/
function modelConversionForNewPDP(model) {
var newModel = model;
let newModel = model;
if (model.indexOf(".") > 0) {
newModel = model.replace(/\./g, "-");
}
if (endsWith(newModel, "-W")) {

@@ -38,14 +41,11 @@ newModel = newModel.substr(0, newModel.lastIndexOf("-W"));

}
return newModel;
}
function querySt(ji, or) {
var hu = or ? or : window.location.search.substring(1),
gy = hu.split("&"),
ft,
i;
let hu = or ? or : window.location.search.substring(1),
gy = hu.split("&"),
ft,
i;
for (i = 0; i < gy.length; i++) {
ft = gy[i].split("=");
if (ft[0].toLowerCase() === ji.toLowerCase()) {

@@ -55,14 +55,13 @@ return ft[1];

}
return "";
}
function removeQueryStringParameter(url, key) {
var newUrl = url,
urlparts = url.split("?");
let newUrl = url,
urlparts = url.split("?");
if (urlparts.length >= 2) {
var prefix = "".concat(encodeURIComponent(key), "=");
var pars = urlparts[1].split(/[&;]/g); // Reverse iteration as may be destructive
const prefix = `${encodeURIComponent(key)}=`;
const pars = urlparts[1].split(/[&;]/g);
for (var i = pars.length; i-- > 0;) {
// Reverse iteration as may be destructive
for (let i = pars.length; i-- > 0;) {
// Idiom for string.startsWith

@@ -73,9 +72,8 @@ if (pars[i].lastIndexOf(prefix, 0) !== -1) {

}
newUrl = urlparts[0] + (pars.length > 0 ? "?".concat(pars.join("&")) : "");
newUrl = urlparts[0] + (pars.length > 0 ? `?${pars.join("&")}` : "");
return newUrl;
}
return newUrl;
}
/*

@@ -88,12 +86,8 @@ * Converts a simple object to query parameters

*/
function toQueryParams(obj) {
var url = Object.keys(obj).map(function (x) {
const url = Object.keys(obj).map(x => {
if (Array.isArray(obj[x])) {
return obj[x].map(function (i) {
return "".concat(encodeURIComponent(x), "=").concat(encodeURIComponent(i));
}).join("&");
return obj[x].map(i => `${encodeURIComponent(x)}=${encodeURIComponent(i)}`).join("&");
}
return "".concat(encodeURIComponent(x), "=").concat(encodeURIComponent(obj[x]));
return `${encodeURIComponent(x)}=${encodeURIComponent(obj[x])}`;
}).join("&");

@@ -103,16 +97,14 @@ return url;

function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])".concat(key, "=.*?(&|$)"), "i");
var separator = uri.indexOf("?") > -1 ? "&" : "?";
const re = new RegExp(`([?&])${key}=.*?(&|$)`, "i");
const separator = uri.indexOf("?") > -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
} // If adding country to url, add it before search
return uri.replace(re, `$1${key}=${value}$2`);
}
// If adding country to url, add it before search
if (uri.match("search=")) {
var arr = uri.split("&");
return "".concat(arr[0] + separator + key, "=").concat(value, "&").concat(arr[1]);
const arr = uri.split("&");
return `${arr[0] + separator + key}=${value}&${arr[1]}`;
}
return "".concat(uri + separator + key, "=").concat(value);
return `${uri + separator + key}=${value}`;
}

@@ -129,3 +121,3 @@

})));
}));
//# sourceMappingURL=index.js.map
{
"name": "@arcteryx/js-url",
"version": "1.27.12",
"version": "1.28.0",
"source": "src/index.js",

@@ -13,3 +13,3 @@ "main": "dist/cjs/index.js",

"license": "ISC",
"gitHead": "531ab111333cf1e210ac88101a83b03958085201",
"gitHead": "ec3795a7d5bb844c4d9931d9f32cf1416d09e081",
"files": [

@@ -16,0 +16,0 @@ "dist",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc