query-string
Advanced tools
Comparing version 8.2.0 to 9.0.0
21
base.js
@@ -8,3 +8,3 @@ import decodeComponent from 'decode-uri-component'; | ||
// eslint-disable-next-line unicorn/prefer-code-point | ||
const strictUriEncode = string => encodeURIComponent(string).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
const strictUriEncode = string => encodeURIComponent(string).replaceAll(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
@@ -91,3 +91,3 @@ const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier'); | ||
case 'bracket-separator': { | ||
const keyValueSep = options.arrayFormat === 'bracket-separator' | ||
const keyValueSeparator = options.arrayFormat === 'bracket-separator' | ||
? '[]=' | ||
@@ -109,3 +109,3 @@ : '='; | ||
if (result.length === 0) { | ||
return [[encode(key, options), keyValueSep, encode(value, options)].join('')]; | ||
return [[encode(key, options), keyValueSeparator, encode(value, options)].join('')]; | ||
} | ||
@@ -359,3 +359,3 @@ | ||
const parameter_ = options.decode ? parameter.replace(/\+/g, ' ') : parameter; | ||
const parameter_ = options.decode ? parameter.replaceAll('+', ' ') : parameter; | ||
@@ -402,6 +402,9 @@ let [key, value] = splitOnFirst(parameter_, '='); | ||
options = {encode: true, | ||
options = { | ||
encode: true, | ||
strict: true, | ||
arrayFormat: 'none', | ||
arrayFormatSeparator: ',', ...options}; | ||
arrayFormatSeparator: ',', | ||
...options, | ||
}; | ||
@@ -492,8 +495,6 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
let queryString = stringify(query, options); | ||
if (queryString) { | ||
queryString = `?${queryString}`; | ||
} | ||
queryString &&= `?${queryString}`; | ||
let hash = getHash(object.url); | ||
if (object.fragmentIdentifier) { | ||
if (typeof object.fragmentIdentifier === 'string') { | ||
const urlObjectForFragmentEncode = new URL(url); | ||
@@ -500,0 +501,0 @@ urlObjectForFragmentEncode.hash = object.fragmentIdentifier; |
{ | ||
"name": "query-string", | ||
"version": "8.2.0", | ||
"version": "9.0.0", | ||
"description": "Parse and stringify URL query strings", | ||
@@ -20,3 +20,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=14.16" | ||
"node": ">=18" | ||
}, | ||
@@ -55,8 +55,8 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^5.1.0", | ||
"ava": "^6.1.1", | ||
"benchmark": "^2.1.4", | ||
"deep-equal": "^2.1.0", | ||
"fast-check": "^3.4.0", | ||
"tsd": "^0.25.0", | ||
"xo": "^0.54.2" | ||
"deep-equal": "^2.2.3", | ||
"fast-check": "^3.15.1", | ||
"tsd": "^0.30.7", | ||
"xo": "^0.57.0" | ||
}, | ||
@@ -63,0 +63,0 @@ "tsd": { |
@@ -47,3 +47,4 @@ # query-string | ||
**Not `npm install querystring`!!!!!** | ||
> [!WARNING] | ||
> Remember the hyphen! Do not install the deprecated [`querystring`](https://github.com/Gozala/querystring) package! | ||
@@ -50,0 +51,0 @@ For browser usage, this package targets the latest version of Chrome, Firefox, and Safari. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46088
854
626