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

query-string

Package Overview
Dependencies
Maintainers
1
Versions
82
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 6.8.2 to 6.8.3

8

index.d.ts

@@ -56,7 +56,7 @@ export interface ParseOptions {

});
// => {c: 'three', a: 'one', b: 'two'}
//=> {c: 'three', a: 'one', b: 'two'}
```
queryString.parse('?a=one&c=three&b=two', {sort: false});
// => {a: 'one', c: 'three', b: 'two'}
//=> {a: 'one', c: 'three', b: 'two'}
```

@@ -189,6 +189,6 @@ */

});
// => 'c=3&a=1&b=2'
//=> 'c=3&a=1&b=2'
queryString.stringify({b: 1, c: 2, a: 3}, {sort: false});
// => 'b=1&c=2&a=3'
//=> 'b=1&c=2&a=3'
```

@@ -195,0 +195,0 @@ */

@@ -174,2 +174,12 @@ 'use strict';

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

@@ -205,10 +215,14 @@ options = Object.assign({

value = value === undefined ? null : decode(value, options);
formatter(decode(key, options), value, ret);
}
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
value = Number(value);
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
value = value.toLowerCase() === 'true';
for (const key of Object.keys(ret)) {
const value = ret[key];
if (typeof value === 'object' && value !== null) {
for (const k of Object.keys(value)) {
value[k] = parseValue(value[k], options);
}
} else {
ret[key] = parseValue(value, options);
}
formatter(decode(key, options), value, ret);
}

@@ -215,0 +229,0 @@

{
"name": "query-string",
"version": "6.8.2",
"version": "6.8.3",
"description": "Parse and stringify URL query strings",

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

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