Skip to content

Commit 02f64c5

Browse files
committed
Cleanup
1 parent 59d53d6 commit 02f64c5

File tree

6 files changed

+156
-147
lines changed

6 files changed

+156
-147
lines changed

package.json

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
{
2-
"name": "query-string",
3-
"version": "5.0.1",
4-
"description": "Parse and stringify URL query strings",
5-
"license": "MIT",
6-
"repository": "sindresorhus/query-string",
7-
"author": {
8-
"name": "Sindre Sorhus",
9-
"email": "[email protected]",
10-
"url": "sindresorhus.com"
11-
},
12-
"engines": {
13-
"node": ">=0.10.0"
14-
},
15-
"scripts": {
16-
"test": "xo && ava"
17-
},
18-
"files": [
19-
"index.js"
20-
],
21-
"keywords": [
22-
"browser",
23-
"querystring",
24-
"query",
25-
"string",
26-
"qs",
27-
"param",
28-
"parameter",
29-
"url",
30-
"uri",
31-
"parse",
32-
"stringify",
33-
"encode",
34-
"decode"
35-
],
36-
"dependencies": {
37-
"decode-uri-component": "^0.2.0",
38-
"object-assign": "^4.1.0",
39-
"strict-uri-encode": "^1.0.0"
40-
},
41-
"devDependencies": {
42-
"ava": "^0.17.0",
43-
"xo": "^0.16.0"
44-
}
2+
"name": "query-string",
3+
"version": "5.0.1",
4+
"description": "Parse and stringify URL query strings",
5+
"license": "MIT",
6+
"repository": "sindresorhus/query-string",
7+
"author": {
8+
"name": "Sindre Sorhus",
9+
"email": "[email protected]",
10+
"url": "sindresorhus.com"
11+
},
12+
"engines": {
13+
"node": ">=0.10.0"
14+
},
15+
"scripts": {
16+
"test": "xo && ava"
17+
},
18+
"files": [
19+
"index.js"
20+
],
21+
"keywords": [
22+
"browser",
23+
"querystring",
24+
"query",
25+
"string",
26+
"qs",
27+
"param",
28+
"parameter",
29+
"url",
30+
"uri",
31+
"parse",
32+
"stringify",
33+
"encode",
34+
"decode"
35+
],
36+
"dependencies": {
37+
"decode-uri-component": "^0.2.0",
38+
"object-assign": "^4.1.0",
39+
"strict-uri-encode": "^1.0.0"
40+
},
41+
"devDependencies": {
42+
"ava": "^0.17.0",
43+
"xo": "^0.16.0"
44+
}
4545
}

readme.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# query-string [![Build Status](https://travis-ci.org/sindresorhus/query-string.svg?branch=master)](https://travis-ci.org/sindresorhus/query-string)
22

3-
> Parse and stringify URL [query strings](http://en.wikipedia.org/wiki/Query_string)
3+
> Parse and stringify URL [query strings](https://en.wikipedia.org/wiki/Query_string)
44
55
---
66

7-
<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>
7+
<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.<br>Also check out his <a href="https://LearnNode.com/friend/AWESOME">Node.js</a>, <a href="https://ReactForBeginners.com/friend/AWESOME">React</a>, <a href="https://SublimeTextBook.com/friend/AWESOME">Sublime</a> courses.</p>
88

99
---
1010

@@ -15,6 +15,10 @@
1515
$ npm install query-string
1616
```
1717

18+
<a href="https://www.patreon.com/sindresorhus">
19+
<img src="https://c5.patreon.com/external/logo/[email protected]" width="160">
20+
</a>
21+
1822

1923
## Usage
2024

@@ -137,9 +141,7 @@ queryString.stringify({foo: [1,2,3]});
137141

138142
Type: `Function` `boolean`
139143

140-
Supports both `Function` as a custom sorting function or `false` for disabling sorting.
141-
142-
- `Function`:
144+
Supports both `Function` as a custom sorting function or `false` to disable sorting.
143145

144146
```js
145147
const order = ['c', 'a', 'b'];
@@ -149,8 +151,6 @@ queryString.stringify({ a: 1, b: 2, c: 3}, {
149151
// => 'c=3&a=1&b=2'
150152
```
151153

152-
- `false`:
153-
154154
```js
155155
queryString.stringify({ b: 1, c: 2, a: 3}, {sort: false});
156156
// => 'c=3&a=1&b=2'
@@ -162,7 +162,6 @@ If omitted, keys are sorted using `Array#sort`, which means, converting them to
162162

163163
Extract a query string from a URL that can be passed into `.parse()`.
164164

165-
166165
### .parseUrl(*string*, *[options]*)
167166

168167
Extract the URL and the query string as an object.
@@ -172,8 +171,8 @@ The `options` are the same as for `.parse()`.
172171
Returns an object with a `url` and `query` property.
173172

174173
```js
175-
queryString.parseUrl('http://foo.bar?foo=bar')
176-
//=> {url: 'http://foo.bar', query: {foo: 'bar'}}
174+
queryString.parseUrl('https://foo.bar?foo=bar');
175+
//=> {url: 'https://foo.bar', query: {foo: 'bar'}}
177176
```
178177

179178

test/extract.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
import test from 'ava';
2-
import fn from '../';
2+
import m from '..';
33

4-
test('should extract query string from url', t => {
5-
t.is(fn.extract('http://foo.bar/?abc=def&hij=klm'), 'abc=def&hij=klm');
6-
t.is(fn.extract('http://foo.bar/?'), '');
7-
t.is(fn.extract('http://foo.bar/?regex=ab?c'), 'regex=ab?c');
4+
test('extracts query string from url', t => {
5+
t.is(m.extract('https://foo.bar/?abc=def&hij=klm'), 'abc=def&hij=klm');
6+
t.is(m.extract('https://foo.bar/?'), '');
7+
t.is(m.extract('https://foo.bar/?regex=ab?c'), 'regex=ab?c');
88
});
99

10-
test('should handle strings not containing query string', t => {
11-
t.is(fn.extract('http://foo.bar/'), '');
12-
t.is(fn.extract(''), '');
10+
test('handles strings not containing query string', t => {
11+
t.is(m.extract('https://foo.bar'), '');
12+
t.is(m.extract(''), '');
1313
});
1414

15-
test('should throw for invalid values', t => {
16-
t.throws(fn.extract.bind(fn, null), TypeError);
17-
t.throws(fn.extract.bind(fn, undefined), TypeError);
15+
test('throws for invalid values', t => {
16+
t.throws(() => {
17+
m.extract(null);
18+
}, TypeError);
19+
20+
t.throws(() => {
21+
m.extract(undefined);
22+
}, TypeError);
1823
});

test/parse-url.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
import test from 'ava';
2-
import fn from '../';
2+
import m from '..';
33

4-
test('should handle strings with query string', t => {
5-
t.deepEqual(fn.parseUrl('http://foo.bar?foo=bar'), {url: 'http://foo.bar', query: {foo: 'bar'}});
6-
t.deepEqual(fn.parseUrl('http://foo.bar?foo=bar&foo=baz'), {url: 'http://foo.bar', query: {foo: ['bar', 'baz']}});
4+
test('handles strings with query string', t => {
5+
t.deepEqual(m.parseUrl('https://foo.bar?foo=bar'), {url: 'https://foo.bar', query: {foo: 'bar'}});
6+
t.deepEqual(m.parseUrl('https://foo.bar?foo=bar&foo=baz'), {url: 'https://foo.bar', query: {foo: ['bar', 'baz']}});
77
});
88

9-
test('should handle strings not containing query string', t => {
10-
t.deepEqual(fn.parseUrl('http://foo.bar/'), {url: 'http://foo.bar/', query: {}});
11-
t.deepEqual(fn.parseUrl(''), {url: '', query: {}});
9+
test('handles strings not containing query string', t => {
10+
t.deepEqual(m.parseUrl('https://foo.bar/'), {url: 'https://foo.bar/', query: {}});
11+
t.deepEqual(m.parseUrl(''), {url: '', query: {}});
1212
});
1313

14-
test('should throw for invalid values', t => {
15-
t.throws(fn.parseUrl.bind(fn, null), TypeError);
16-
t.throws(fn.parseUrl.bind(fn, undefined), TypeError);
14+
test('throws for invalid values', t => {
15+
t.throws(() => {
16+
m.parseUrl(null);
17+
}, TypeError);
18+
19+
t.throws(() => {
20+
m.parseUrl(undefined);
21+
}, TypeError);
1722
});

0 commit comments

Comments
 (0)