Socket
Socket
Sign inDemoInstall

query-string

Package Overview
Dependencies
Maintainers
1
Versions
81
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 7.0.1 to 7.1.0

22

index.d.ts

@@ -72,2 +72,11 @@ export interface ParseOptions {

- `colon-list-separator`: Parse arrays with parameter names that are explicitly marked with `:list`:
```
import queryString = require('query-string');
queryString.parse('foo:list=one&foo:list=two', {arrayFormat: 'colon-list-separator'});
//=> {foo: ['one', 'two']}
```
- `none`: Parse arrays with elements using duplicate keys:

@@ -82,3 +91,3 @@

*/
readonly arrayFormat?: 'bracket' | 'index' | 'comma' | 'separator' | 'bracket-separator' | 'none';
readonly arrayFormat?: 'bracket' | 'index' | 'comma' | 'separator' | 'bracket-separator' | 'colon-list-separator' | 'none';

@@ -301,2 +310,11 @@ /**

- `colon-list-separator`: Serialize arrays with parameter names that are explicitly marked with `:list`:
```js
import queryString = require('query-string');
queryString.stringify({foo: ['one', 'two']}, {arrayFormat: 'colon-list-separator'});
//=> 'foo:list=one&foo:list=two'
```
- `none`: Serialize arrays by using duplicate keys:

@@ -311,3 +329,3 @@

*/
readonly arrayFormat?: 'bracket' | 'index' | 'comma' | 'separator' | 'bracket-separator' | 'none';
readonly arrayFormat?: 'bracket' | 'index' | 'comma' | 'separator' | 'bracket-separator' | 'colon-list-separator' | 'none';

@@ -314,0 +332,0 @@ /**

@@ -52,2 +52,19 @@ 'use strict';

case 'colon-list-separator':
return key => (result, value) => {
if (
value === undefined ||
(options.skipNull && value === null) ||
(options.skipEmptyString && value === '')
) {
return result;
}
if (value === null) {
return [...result, [encode(key, options), ':list='].join('')];
}
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')];
};
case 'comma':

@@ -139,2 +156,20 @@ case 'separator':

case 'colon-list-separator':
return (key, value, accumulator) => {
result = /(:list)$/.exec(key);
key = key.replace(/:list$/, '');
if (!result) {
accumulator[key] = value;
return;
}
if (accumulator[key] === undefined) {
accumulator[key] = [value];
return;
}
accumulator[key] = [].concat(accumulator[key], value);
};
case 'comma':

@@ -141,0 +176,0 @@ case 'separator':

2

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

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

@@ -187,2 +187,11 @@ # query-string

- `'colon-list-separator'`: Parse arrays with parameter names that are explicitly marked with `:list`:
```js
const queryString = require('query-string');
queryString.parse('foo:list=one&foo:list=two', {arrayFormat: 'colon-list-separator'});
//=> {foo: ['one', 'two']}
```
- `'none'`: Parse arrays with elements using duplicate keys:

@@ -334,2 +343,11 @@

- `'colon-list-separator'`: Serialize arrays with parameter names that are explicitly marked with `:list`:
```js
const queryString = require('query-string');
queryString.stringify({foo: ['one', 'two']}, {arrayFormat: 'colon-list-separator'});
//=> 'foo:list=one&foo:list=two'
```
- `'none'`: Serialize arrays by using duplicate keys:

@@ -336,0 +354,0 @@

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