Skip to content

Commit d4429ad

Browse files
committed
update README.js
1 parent 3312383 commit d4429ad

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
# tiny-querystring
22

3+
Tiny parsing and formatting URL query strings for Node.js and browser. (Only 430B only after gziped)
4+
5+
6+
## Installation
7+
8+
##### NPM
9+
10+
```bash
11+
npm install tiny-querystring
12+
```
13+
14+
##### Yarn
15+
16+
```bash
17+
yarn add tiny-querystring
18+
```
19+
20+
##### 1998 Script Tag
21+
22+
```html
23+
<script src="https://unpkg.com/tiny-querystring/dist/tiny-querystring.umd.js"></script>
24+
```
25+
26+
## Usage
27+
28+
### parse(str)
29+
30+
Parses a URL query string (str) into a collection of key and value pairs.
31+
32+
###### Example
33+
34+
```js
35+
import { parse } from 'tiny-querystring';
36+
parse('foo=bar&abc=xyz&abc=123');
37+
/* returns { foo: 'bar', abc: ['xyz', '123'] } */
38+
```
39+
40+
### stringify(obj)
41+
42+
Produces a URL query string from a given obj by iterating through the object's "own properties".
43+
44+
###### Example
45+
46+
```js
47+
import { stringify } from 'tiny-querystring';
48+
stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
49+
50+
/* returns 'foo=bar&baz=qux&baz=quux&corge=' */
51+
```
52+
53+
354
## License
455

556
MIT

0 commit comments

Comments
 (0)