You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

query-string

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-string - npm Package Compare versions

Comparing version

to
9.1.2

12

base.js

@@ -312,6 +312,10 @@ import decodeComponent from 'decode-uri-component';

if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
return value.toLowerCase() === 'true';
if (type === 'string[]' && options.arrayFormat !== 'none' && typeof value === 'string') {
return [value];
}
if (type === 'number[]' && options.arrayFormat !== 'none' && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
return [Number(value)];
}
if (type === 'number' && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {

@@ -321,2 +325,6 @@ return Number(value);

if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
return value.toLowerCase() === 'true';
}
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {

@@ -323,0 +331,0 @@ return Number(value);

2

package.json
{
"name": "query-string",
"version": "9.1.1",
"version": "9.1.2",
"description": "Parse and stringify URL query strings",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -5,26 +5,2 @@ # query-string

<br>
---
<div align="center">
<p>
<p>
<sup>
<a href="https://github.com/sponsors/sindresorhus">My open source work is supported by the community</a>
</sup>
</p>
<sup>Special thanks to:</sup>
<br>
<br>
<a href="https://standardresume.co/tech">
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="180"/>
</a>
</p>
</div>
---
<br>
## Install

@@ -221,3 +197,3 @@

Specify a pre-defined schema to be used when parsing values. The types specified will take precedence over options such as: `parseNumber`, `parseBooleans`, and `arrayFormat`.
Specify a pre-defined schema to be used when parsing values. The types specified will take precedence over options such as: `parseNumbers`, `parseBooleans`, and `arrayFormat`.

@@ -230,3 +206,3 @@ Use this feature to override the type of a value. This can be useful when the type is ambiguous such as a phone number.

- `'string'`: Parse `phoneNumber` as a string (overriding the `parseNumber` option):
- `'string'`: Parse `phoneNumber` as a string (overriding the `parseNumbers` option):

@@ -245,3 +221,3 @@ ```js

- `'number'`: Parse `age` as a number (even when `parseNumber` is false):
- `'number'`: Parse `age` as a number (even when `parseNumbers` is false):

@@ -259,3 +235,3 @@ ```js

- `'string[]'`: Parse `items` as an array of strings (overriding the `parseNumber` option):
- `'string[]'`: Parse `items` as an array of strings (overriding the `parseNumbers` option):

@@ -266,3 +242,3 @@ ```js

queryString.parse('?age=20&items=1%2C2%2C3', {
parseNumber: true,
parseNumbers: true,
types: {

@@ -275,3 +251,3 @@ items: 'string[]',

- `'number[]'`: Parse `items` as an array of numbers (even when `parseNumber` is false):
- `'number[]'`: Parse `items` as an array of numbers (even when `parseNumbers` is false):

@@ -278,0 +254,0 @@ ```js