{"name":"query-string","version":"9.2.1","keywords":["browser","querystring","query","string","qs","param","parameter","url","parse","stringify","encode","decode","searchparams","filter"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"query-string@9.2.1","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/query-string#readme","bugs":{"url":"https://github.com/sindresorhus/query-string/issues"},"tsd":{"compilerOptions":{"module":"node16"}},"dist":{"shasum":"67bd95f6e2cb64eafecfb0504be7cc38bcd4dd11","tarball":"http://registry-npm.ywwl.com/query-string/download/query-string-9.2.1.tgz","fileCount":7,"integrity":"sha512-3jTGGLRzlhu/1ws2zlr4Q+GVMLCQTLFOj8CMX5x44cdZG9FQE07x2mQhaNxaKVPNmIDu0mvJ/cEwtY7Pim7hqA==","signatures":[{"sig":"MEQCIExSqqMM6oq7mTPIzpa+JkuGKn9z5H8j0yY0qFTovnldAiABOvhcVYRXi3Nbjbe6ReXgBDwIsBUaMxfRen3IJZlffg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52840,"size":10564,"noattachment":false,"key":"/query-string/-/query-string-9.2.1.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=18"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"a2779215ca5f3bf31e21bda2a79c73aec68492a8","scripts":{"test":"xo && ava && tsd","benchmark":"node benchmark.js"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/query-string.git","type":"git"},"_npmVersion":"10.9.2","description":"Parse and stringify URL query strings","directories":{},"sideEffects":false,"_nodeVersion":"20.19.1","dependencies":{"filter-obj":"^5.1.0","split-on-first":"^3.0.0","decode-uri-component":"^0.4.1"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.57.0","ava":"^6.1.1","tsd":"^0.30.7","benchmark":"^2.1.4","deep-equal":"^2.2.3","fast-check":"^3.15.1"},"_npmOperationalInternal":{"tmp":"tmp/query-string_9.2.1_1749998615592_0.9626344347885545","host":"s3://npm-registry-packages-npm-production"},"readme":"# query-string\n\n> Parse and stringify URL [query strings](https://en.wikipedia.org/wiki/Query_string)\n\n## Install\n\n```sh\nnpm install query-string\n```\n\n> [!WARNING]\n> Remember the hyphen! Do not install the deprecated [`querystring`](https://github.com/Gozala/querystring) package!\n\nFor browser usage, this package targets the latest version of Chrome, Firefox, and Safari.\n\n> [!TIP]\n> Consider using [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) for simple use cases. It's a native browser API that handles basic query string operations.\n\n## Usage\n\n```js\nimport queryString from 'query-string';\n\nconsole.log(location.search);\n//=> '?foo=bar'\n\nconst parsed = queryString.parse(location.search);\nconsole.log(parsed);\n//=> {foo: 'bar'}\n\nconsole.log(location.hash);\n//=> '#token=bada55cafe'\n\nconst parsedHash = queryString.parse(location.hash);\nconsole.log(parsedHash);\n//=> {token: 'bada55cafe'}\n\nparsed.foo = 'unicorn';\nparsed.ilike = 'pizza';\n\nconst stringified = queryString.stringify(parsed);\n//=> 'foo=unicorn&ilike=pizza'\n\nlocation.search = stringified;\n// note that `location.search` automatically prepends a question mark\nconsole.log(location.search);\n//=> '?foo=unicorn&ilike=pizza'\n```\n\n## API\n\n### .parse(string, options?)\n\nParse a query string into an object. Leading `?` or `#` are ignored, so you can pass `location.search` or `location.hash` directly.\n\nThe returned object is created with [`Object.create(null)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create) and thus does not have a `prototype`.\n\n```js\nqueryString.parse('?foo=bar');\n//=> {foo: 'bar'}\n\nqueryString.parse('#token=secret&name=jhon');\n//=> {token: 'secret', name: 'jhon'}\n```\n\n#### options\n\nType: `object`\n\n##### decode\n\nType: `boolean`\\\nDefault: `true`\n\nDecode the keys and values. URL components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component).\n\n##### arrayFormat\n\nType: `string`\\\nDefault: `'none'`\n\n- `'bracket'`: Parse arrays with bracket representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo[]=1&foo[]=2&foo[]=3', {arrayFormat: 'bracket'});\n//=> {foo: ['1', '2', '3']}\n```\n\n- `'index'`: Parse arrays with index representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo[0]=1&foo[1]=2&foo[3]=3', {arrayFormat: 'index'});\n//=> {foo: ['1', '2', '3']}\n```\n\n- `'comma'`: Parse arrays with elements separated by comma:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1,2,3', {arrayFormat: 'comma'});\n//=> {foo: ['1', '2', '3']}\n```\n\n- `'separator'`: Parse arrays with elements separated by a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1|2|3', {arrayFormat: 'separator', arrayFormatSeparator: '|'});\n//=> {foo: ['1', '2', '3']}\n```\n\n- `'bracket-separator'`: Parse arrays (that are explicitly marked with brackets) with elements separated by a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo[]', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> {foo: []}\n\nqueryString.parse('foo[]=', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> {foo: ['']}\n\nqueryString.parse('foo[]=1', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> {foo: ['1']}\n\nqueryString.parse('foo[]=1|2|3', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> {foo: ['1', '2', '3']}\n\nqueryString.parse('foo[]=1||3|||6', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> {foo: ['1', '', 3, '', '', '6']}\n\nqueryString.parse('foo[]=1|2|3&bar=fluffy&baz[]=4', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> {foo: ['1', '2', '3'], bar: 'fluffy', baz:['4']}\n```\n\n- `'colon-list-separator'`: Parse arrays with parameter names that are explicitly marked with `:list`:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo:list=one&foo:list=two', {arrayFormat: 'colon-list-separator'});\n//=> {foo: ['one', 'two']}\n```\n\n- `'none'`: Parse arrays with elements using duplicate keys:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1&foo=2&foo=3');\n//=> {foo: ['1', '2', '3']}\n```\n\n##### arrayFormatSeparator\n\nType: `string`\\\nDefault: `','`\n\nThe character used to separate array elements when using `{arrayFormat: 'separator'}`.\n\n##### sort\n\nType: `Function | boolean`\\\nDefault: `true`\n\nSupports both `Function` as a custom sorting function or `false` to disable sorting.\n\n##### parseNumbers\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1', {parseNumbers: true});\n//=> {foo: 1}\n```\n\nParse the value as a number type instead of string type if it's a number.\n\n##### parseBooleans\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=true', {parseBooleans: true});\n//=> {foo: true}\n```\n\nParse the value as a boolean type instead of string type if it's a boolean.\n\n##### types\n\nType: `object`\\\nDefault: `{}`\n\nSpecifies a schema for parsing query values with explicit type declarations. When defined, the types provided here take precedence over general parsing options such as `parseNumbers`, `parseBooleans`, and `arrayFormat`.\n\nUse this option to explicitly define the type of a specific parameter—particularly useful in cases where the type might otherwise be ambiguous (e.g., phone numbers or IDs).\n\nYou can also provide a custom function to transform the value. The function will receive the raw string and should return the desired parsed result. When used with array formats (like `comma`, `separator`, `bracket`, etc.), the function is applied to each array element individually.\n\nSupported Types:\n\n\n- `'boolean'`: Parse `flagged` as a boolean (overriding the `parseBooleans` option):\n\n```js\nqueryString.parse('?isAdmin=true&flagged=true&isOkay=0', {\n\t\tparseBooleans: false,\n\t\ttypes: {\n\t\t\t\tflagged: 'boolean',\n\t\t\t\tisOkay: 'boolean',\n\t\t},\n});\n//=> {isAdmin: 'true', flagged: true, isOkay: false}\n```\n\nNote: The `'boolean'` type also converts `'0'` and `'1'` to booleans, and treats valueless keys (e.g. `?flag`) as `true`.\n\n- `'string'`: Parse `phoneNumber` as a string (overriding the `parseNumbers` option):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?phoneNumber=%2B380951234567&id=1', {\n\tparseNumbers: true,\n\ttypes: {\n\t\tphoneNumber: 'string',\n\t}\n});\n//=> {phoneNumber: '+380951234567', id: 1}\n```\n\n- `'number'`:  Parse `age` as a number (even when `parseNumbers` is false):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20&id=01234&zipcode=90210', {\n\ttypes: {\n\t\tage: 'number',\n\t}\n});\n//=> {age: 20, id: '01234', zipcode: '90210'}\n```\n\n- `'string[]'`:  Parse `items` as an array of strings (overriding the `parseNumbers` option):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20&items=1%2C2%2C3', {\n\tparseNumbers: true,\n\ttypes: {\n\t\titems: 'string[]',\n\t}\n});\n//=> {age: 20, items: ['1', '2', '3']}\n```\n\n- `'number[]'`:  Parse `items` as an array of numbers (even when `parseNumbers` is false):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20&items=1%2C2%2C3', {\n\ttypes: {\n\t\titems: 'number[]',\n\t}\n});\n//=> {age: '20', items: [1, 2, 3]}\n```\n\n- `'Function'`: Provide a custom function as the parameter type. The parameter's value will equal the function's return value. When used with array formats (like `comma`, `separator`, `bracket`, etc.), the function is applied to each array element individually.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20&id=01234&zipcode=90210', {\n\ttypes: {\n\t\tage: value => value * 2,\n\t}\n});\n//=> {age: 40, id: '01234', zipcode: '90210'}\n\n// With arrays, the function is applied to each element\nqueryString.parse('?scores=10,20,30', {\n\tarrayFormat: 'comma',\n\ttypes: {\n\t\tscores: value => Number(value) * 2,\n\t}\n});\n//=> {scores: [20, 40, 60]}\n```\n\nNOTE: Array types (`string[]`, `number[]`) are ignored if `arrayFormat` is set to `'none'`.\n\n```js\nqueryString.parse('ids=001%2C002%2C003&foods=apple%2Corange%2Cmango', {\n\tarrayFormat: 'none',\n\ttypes: {\n\t\tids: 'number[]',\n\t\tfoods: 'string[]',\n\t},\n}\n//=> {ids:'001,002,003', foods:'apple,orange,mango'}\n```\n\n###### Function\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20&id=01234&zipcode=90210', {\n\ttypes: {\n\t\tage: value => value * 2,\n\t}\n});\n//=> {age: 40, id: '01234', zipcode: '90210'}\n```\n\nParse the value as a boolean type instead of string type if it's a boolean.\n\n### .stringify(object, options?)\n\nStringify an object into a query string and sorting the keys.\n\n**Supported value types:** `string`, `number`, `bigint`, `boolean`, `null`, `undefined`, and arrays of these types. Other types like `Symbol`, functions, or objects (except arrays) will throw an error.\n\n#### options\n\nType: `object`\n\n##### strict\n\nType: `boolean`\\\nDefault: `true`\n\nStrictly encode URI components. It uses [encodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) if set to false. You probably [don't care](https://github.com/sindresorhus/query-string/issues/42) about this option.\n\n##### encode\n\nType: `boolean`\\\nDefault: `true`\n\n[URL encode](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) the keys and values.\n\n##### arrayFormat\n\nType: `string`\\\nDefault: `'none'`\n\n- `'bracket'`: Serialize arrays using bracket representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'bracket'});\n//=> 'foo[]=1&foo[]=2&foo[]=3'\n```\n\n- `'index'`: Serialize arrays using index representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'index'});\n//=> 'foo[0]=1&foo[1]=2&foo[2]=3'\n```\n\n- `'comma'`: Serialize arrays by separating elements with comma:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'comma'});\n//=> 'foo=1,2,3'\n\nqueryString.stringify({foo: [1, null, '']}, {arrayFormat: 'comma'});\n//=> 'foo=1,,'\n// Note that typing information for null values is lost\n// and `.parse('foo=1,,')` would return `{foo: [1, '', '']}`.\n```\n\n- `'separator'`: Serialize arrays by separating elements with a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'separator', arrayFormatSeparator: '|'});\n//=> 'foo=1|2|3'\n```\n\n- `'bracket-separator'`: Serialize arrays by explicitly post-fixing array names with brackets and separating elements with a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: []}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> 'foo[]'\n\nqueryString.stringify({foo: ['']}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> 'foo[]='\n\nqueryString.stringify({foo: [1]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> 'foo[]=1'\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> 'foo[]=1|2|3'\n\nqueryString.stringify({foo: [1, '', 3, null, null, 6]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> 'foo[]=1||3|||6'\n\nqueryString.stringify({foo: [1, '', 3, null, null, 6]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|', skipNull: true});\n//=> 'foo[]=1||3|6'\n\nqueryString.stringify({foo: [1, 2, 3], bar: 'fluffy', baz: [4]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=> 'foo[]=1|2|3&bar=fluffy&baz[]=4'\n```\n\n- `'colon-list-separator'`: Serialize arrays with parameter names that are explicitly marked with `:list`:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: ['one', 'two']}, {arrayFormat: 'colon-list-separator'});\n//=> 'foo:list=one&foo:list=two'\n```\n\n- `'none'`: Serialize arrays by using duplicate keys:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]});\n//=> 'foo=1&foo=2&foo=3'\n```\n\n##### arrayFormatSeparator\n\nType: `string`\\\nDefault: `','`\n\nThe character used to separate array elements when using `{arrayFormat: 'separator'}`.\n\n##### sort\n\nType: `Function | boolean`\n\nSupports both `Function` as a custom sorting function or `false` to disable sorting.\n\n```js\nimport queryString from 'query-string';\n\nconst order = ['c', 'a', 'b'];\n\nqueryString.stringify({a: 1, b: 2, c: 3}, {\n\tsort: (a, b) => order.indexOf(a) - order.indexOf(b)\n});\n//=> 'c=3&a=1&b=2'\n```\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({b: 1, c: 2, a: 3}, {sort: false});\n//=> 'b=1&c=2&a=3'\n```\n\nIf omitted, keys are sorted using `Array#sort()`, which means, converting them to strings and comparing strings in Unicode code point order.\n\n##### skipNull\n\nSkip keys with `null` as the value.\n\nNote that keys with `undefined` as the value are always skipped.\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: 1, b: undefined, c: null, d: 4}, {\n\tskipNull: true\n});\n//=> 'a=1&d=4'\n```\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: undefined, b: null}, {\n\tskipNull: true\n});\n//=> ''\n```\n\n##### skipEmptyString\n\nSkip keys with an empty string as the value.\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: 1, b: '', c: '', d: 4}, {\n\tskipEmptyString: true\n});\n//=> 'a=1&d=4'\n```\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: '', b: ''}, {\n\tskipEmptyString: true\n});\n//=> ''\n```\n\n##### replacer\n\nA function that transforms key-value pairs before stringification.\n\nType: `function`\\\nDefault: `undefined`\n\nSimilar to the `replacer` parameter of `JSON.stringify()`, this function is called for each key-value pair and can be used to transform values before they are stringified. The function receives the key and value, and should return the transformed value. Returning `undefined` will omit the key-value pair from the resulting query string.\n\nThis is useful for custom serialization of non-primitive types like `Date`:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({\n\tdate: new Date('2024-01-15T10:30:00Z'),\n\tname: 'John'\n}, {\n\treplacer: (key, value) => {\n\t\tif (value instanceof Date) {\n\t\t\treturn value.toISOString();\n\t\t}\n\n\t\treturn value;\n\t}\n});\n//=> 'date=2024-01-15T10%3A30%3A00.000Z&name=John'\n```\n\nYou can also use it to filter out keys:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({\n\ta: 1,\n\tb: null,\n\tc: 3\n}, {\n\treplacer: (key, value) => value === null ? undefined : value\n});\n//=> 'a=1&c=3'\n```\n\n### .extract(string)\n\nExtract a query string from a URL that can be passed into `.parse()`.\n\n```js\nqueryString.extract('https://foo.bar?foo=bar');\n//=> 'foo=bar'\n```\n\n### .parseUrl(string, options?)\n\nExtract the URL and the query string as an object.\n\nReturns an object with a `url` and `query` property.\n\nIf the `parseFragmentIdentifier` option is `true`, the object will also contain a `fragmentIdentifier` property.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parseUrl('https://foo.bar?foo=bar');\n//=> {url: 'https://foo.bar', query: {foo: 'bar'}}\n\nqueryString.parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true});\n//=> {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'}\n```\n\n#### options\n\nType: `object`\n\nThe options are the same as for `.parse()`.\n\nExtra options are as below.\n\n##### parseFragmentIdentifier\n\nParse the fragment identifier from the URL.\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true});\n//=> {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'}\n```\n\n### .stringifyUrl(object, options?)\n\nStringify an object into a URL with a query string and sorting the keys. The inverse of [`.parseUrl()`](https://github.com/sindresorhus/query-string#parseurlstring-options)\n\nThe `options` are the same as for `.stringify()`.\n\nReturns a string with the URL and a query string.\n\nQuery items in the `query` property overrides queries in the `url` property.\n\nThe `fragmentIdentifier` property overrides the fragment identifier in the `url` property.\n\n```js\nqueryString.stringifyUrl({url: 'https://foo.bar', query: {foo: 'bar'}});\n//=> 'https://foo.bar?foo=bar'\n\nqueryString.stringifyUrl({url: 'https://foo.bar?foo=baz', query: {foo: 'bar'}});\n//=> 'https://foo.bar?foo=bar'\n\nqueryString.stringifyUrl({\n\turl: 'https://foo.bar',\n\tquery: {\n\t\ttop: 'foo'\n\t},\n\tfragmentIdentifier: 'bar'\n});\n//=> 'https://foo.bar?top=foo#bar'\n```\n\n#### object\n\nType: `object`\n\n##### url\n\nType: `string`\n\nThe URL to stringify.\n\n##### query\n\nType: `object`\n\nQuery items to add to the URL.\n\n### .pick(url, keys, options?)\n### .pick(url, filter, options?)\n\nPick query parameters from a URL.\n\nReturns a string with the new URL.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.pick('https://foo.bar?foo=1&bar=2#hello', ['foo']);\n//=> 'https://foo.bar?foo=1#hello'\n\nqueryString.pick('https://foo.bar?foo=1&bar=2#hello', (name, value) => value === 2, {parseNumbers: true});\n//=> 'https://foo.bar?bar=2#hello'\n```\n\n### .exclude(url, keys, options?)\n### .exclude(url, filter, options?)\n\nExclude query parameters from a URL.\n\nReturns a string with the new URL.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.exclude('https://foo.bar?foo=1&bar=2#hello', ['foo']);\n//=> 'https://foo.bar?bar=2#hello'\n\nqueryString.exclude('https://foo.bar?foo=1&bar=2#hello', (name, value) => value === 2, {parseNumbers: true});\n//=> 'https://foo.bar?foo=1#hello'\n```\n\n#### url\n\nType: `string`\n\nThe URL containing the query parameters to filter.\n\n#### keys\n\nType: `string[]`\n\nThe names of the query parameters to filter based on the function used.\n\n#### filter\n\nType: `(key, value) => boolean`\n\nA filter predicate that will be provided the name of each query parameter and its value. The `parseNumbers` and `parseBooleans` options also affect `value`.\n\n#### options\n\nType: `object`\n\n[Parse options](#options) and [stringify options](#options-1).\n\n## Nesting\n\nThis module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues).\n\nYou're much better off just converting the object to a JSON string:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({\n\tfoo: 'bar',\n\tnested: JSON.stringify({\n\t\tunicorn: 'cake'\n\t})\n});\n//=> 'foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D'\n```\n\nHowever, there is support for multiple instances of the same key:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('likes=cake&name=bob&likes=icecream');\n//=> {likes: ['cake', 'icecream'], name: 'bob'}\n\nqueryString.stringify({color: ['taupe', 'chartreuse'], id: '515'});\n//=> 'color=taupe&color=chartreuse&id=515'\n```\n\n## Falsy values\n\nSometimes you want to unset a key, or maybe just make it present without assigning a value to it. Here is how falsy values are stringified:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: false});\n//=> 'foo=false'\n\nqueryString.stringify({foo: null});\n//=> 'foo'\n\nqueryString.stringify({foo: undefined});\n//=> ''\n```\n\n## FAQ\n\n### Why is it parsing `+` as a space?\n\nSee [this answer](https://github.com/sindresorhus/query-string/issues/305).\n","publish_time":1749998615806,"_cnpm_publish_time":1749998615806,"dist-tags":{"latest":"10.0.0"}}