package.json
7.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
"_args": [
[
{
"raw": "query-string@^4.1.0",
"scope": null,
"escapedName": "query-string",
"name": "query-string",
"rawSpec": "^4.1.0",
"spec": ">=4.1.0 <5.0.0",
"type": "range"
},
"D:\\100-Projects\\100-AIAHTML5\\400-SOURCECODE\\AIAHTML5.Admin\\node_modules\\normalize-url"
]
],
"_from": "query-string@>=4.1.0 <5.0.0",
"_id": "query-string@4.3.4",
"_inCache": true,
"_location": "/query-string",
"_nodeVersion": "7.8.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/query-string-4.3.4.tgz_1492605771151_0.2800749952439219"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "4.2.0",
"_phantomChildren": {},
"_requested": {
"raw": "query-string@^4.1.0",
"scope": null,
"escapedName": "query-string",
"name": "query-string",
"rawSpec": "^4.1.0",
"spec": ">=4.1.0 <5.0.0",
"type": "range"
},
"_requiredBy": [
"/normalize-url"
],
"_resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
"_shasum": "bbb693b9ca915c232515b228b1a02b609043dbeb",
"_shrinkwrap": null,
"_spec": "query-string@^4.1.0",
"_where": "D:\\100-Projects\\100-AIAHTML5\\400-SOURCECODE\\AIAHTML5.Admin\\node_modules\\normalize-url",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/query-string/issues"
},
"dependencies": {
"object-assign": "^4.1.0",
"strict-uri-encode": "^1.0.0"
},
"description": "Parse and stringify URL query strings",
"devDependencies": {
"ava": "^0.17.0",
"xo": "^0.16.0"
},
"directories": {},
"dist": {
"shasum": "bbb693b9ca915c232515b228b1a02b609043dbeb",
"tarball": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "27e4fae3e79d179bcf79c32cf3bb404770ac0491",
"homepage": "https://github.com/sindresorhus/query-string#readme",
"keywords": [
"browser",
"querystring",
"query",
"string",
"qs",
"param",
"parameter",
"url",
"uri",
"parse",
"stringify",
"encode",
"decode"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "query-string",
"optionalDependencies": {},
"readme": "# query-string [](https://travis-ci.org/sindresorhus/query-string)\n\n> Parse and stringify URL [query strings](http://en.wikipedia.org/wiki/Query_string)\n\n---\n\n<p align=\"center\"><b>🔥 Want to strengthen your core JavaScript skills and master ES6?</b><br>I would personally recommend this awesome <a href=\"https://ES6.io/friend/AWESOME\">ES6 course</a> by Wes Bos. You might also like his <a href=\"https://ReactForBeginners.com/friend/AWESOME\">React course</a>.</p>\n\n---\n\n\n## Install\n\n```\n$ npm install --save query-string\n```\n\n\n## Usage\n\n```js\nconst queryString = require('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\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#### arrayFormat\n\nType: `string`<br>\nDefault: `'none'`\n\nSupports both `index` for an indexed array representation or `bracket` for a *bracketed* array representation.\n\n- `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:\n\n```js\nqueryString.parse('foo[]=1&foo[]=2&foo[]=3', {arrayFormat: 'bracket'});\n//=> foo: [1,2,3]\n```\n\n- `index`: stands for parsing taking the index into account, such as:\n\n```js\nqueryString.parse('foo[0]=1&foo[1]=2&foo[3]=3', {arrayFormat: 'index'});\n//=> foo: [1,2,3]\n```\n\n- `none`: is the **default** option and removes any bracket representation, such as:\n\n```js\nqueryString.parse('foo=1&foo=2&foo=3');\n//=> foo: [1,2,3]\n```\n\n### .stringify(*object*, *[options]*)\n\nStringify an object into a query string, sorting the keys.\n\n#### strict\n\nType: `boolean`<br>\nDefault: `true`\n\nStrictly encode URI components with [strict-uri-encode](https://github.com/kevva/strict-uri-encode). It uses [encodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent)\nif 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`<br>\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`<br>\nDefault: `'none'`\n\nSupports both `index` for an indexed array representation or `bracket` for a *bracketed* array representation.\n\n- `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:\n\n```js\nqueryString.stringify({foo: [1,2,3]}, {arrayFormat: 'bracket'});\n// => foo[]=1&foo[]=2&foo[]=3\n```\n\n- `index`: stands for parsing taking the index into account, such as:\n\n```js\nqueryString.stringify({foo: [1,2,3]}, {arrayFormat: 'index'});\n// => foo[0]=1&foo[1]=2&foo[3]=3\n```\n\n- `none`: is the __default__ option and removes any bracket representation, such as:\n\n```js\nqueryString.stringify({foo: [1,2,3]});\n// => foo=1&foo=2&foo=3\n```\n\n### .extract(*string*)\n\nExtract a query string from a URL that can be passed into `.parse()`.\n\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\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\nqueryString.parse('likes=cake&name=bob&likes=icecream');\n//=> {likes: ['cake', 'icecream'], name: 'bob'}\n\nqueryString.stringify({color: ['taupe', 'chartreuse'], id: '515'});\n//=> 'color=chartreuse&color=taupe&id=515'\n```\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\nqueryString.stringify({foo: false});\n//=> 'foo=false'\n\nqueryString.stringify({foo: null});\n//=> 'foo'\n\nqueryString.stringify({foo: undefined});\n//=> ''\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/query-string.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "4.3.4"
}