query-string
Advanced tools
Comparing version 6.0.0 to 6.1.0
16
index.js
@@ -24,3 +24,3 @@ 'use strict'; | ||
return (key, value) => { | ||
return value === null ? encode(key, options) : [ | ||
return value === null ? [encode(key, options), '[]'].join('') : [ | ||
encode(key, options), | ||
@@ -100,2 +100,10 @@ '[]=', | ||
function decode(value, options) { | ||
if (options.decode) { | ||
return decodeComponent(value); | ||
} | ||
return value; | ||
} | ||
function keysSorter(input) { | ||
@@ -124,3 +132,3 @@ if (Array.isArray(input)) { | ||
function parse(input, options) { | ||
options = Object.assign({arrayFormat: 'none'}, options); | ||
options = Object.assign({decode: true, arrayFormat: 'none'}, options); | ||
@@ -147,5 +155,5 @@ const formatter = parserForArrayFormat(options); | ||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters | ||
value = value === undefined ? null : decodeComponent(value); | ||
value = value === undefined ? null : decode(value, options); | ||
formatter(decodeComponent(key), value, ret); | ||
formatter(decode(key, options), value, ret); | ||
} | ||
@@ -152,0 +160,0 @@ |
{ | ||
"name": "query-string", | ||
"version": "6.0.0", | ||
"description": "Parse and stringify URL query strings", | ||
"license": "MIT", | ||
"repository": "sindresorhus/query-string", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"browser", | ||
"querystring", | ||
"query", | ||
"string", | ||
"qs", | ||
"param", | ||
"parameter", | ||
"url", | ||
"parse", | ||
"stringify", | ||
"encode", | ||
"decode", | ||
"searchparams" | ||
], | ||
"dependencies": { | ||
"decode-uri-component": "^0.2.0", | ||
"strict-uri-encode": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "query-string", | ||
"version": "6.1.0", | ||
"description": "Parse and stringify URL query strings", | ||
"license": "MIT", | ||
"repository": "sindresorhus/query-string", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"browser", | ||
"querystring", | ||
"query", | ||
"string", | ||
"qs", | ||
"param", | ||
"parameter", | ||
"url", | ||
"parse", | ||
"stringify", | ||
"encode", | ||
"decode", | ||
"searchparams" | ||
], | ||
"dependencies": { | ||
"decode-uri-component": "^0.2.0", | ||
"strict-uri-encode": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"deep-equal": "^1.0.1", | ||
"fast-check": "^1.0.1", | ||
"xo": "*" | ||
} | ||
} |
@@ -18,3 +18,3 @@ # query-string [![Build Status](https://travis-ci.org/sindresorhus/query-string.svg?branch=master)](https://travis-ci.org/sindresorhus/query-string) | ||
The latest version targets Node.js 6 or later and modern browsers. If you want support for older browsers, use version 5: `npm install query-string@5`. | ||
This module targets Node.js 6 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers, use version 5: `npm install query-string@5`. | ||
@@ -66,4 +66,9 @@ <a href="https://www.patreon.com/sindresorhus"> | ||
URI components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component). | ||
#### decode | ||
Type: `boolean`<br> | ||
Default: `true` | ||
Decode the keys and values. URI components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component). | ||
#### arrayFormat | ||
@@ -70,0 +75,0 @@ |
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
12832
178
232
4