Skip to content

Commit

Permalink
Add example for use with Bower and browser
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 13, 2013
1 parent d243d65 commit 10517cb
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ component install sindresorhus/query-string
```


## Example using Node.js
## Examples

### Node.js

```js
var queryString = require('query-string');
Expand All @@ -42,6 +44,28 @@ console.log(url[0] + '?' + queryString.stringify(parsed));
// http://sindresorhus.com?foo=unicorn&ilike=pizza
```

### Bower

```html
<script src="bower_components/query-string/query-string.js"></script>
```

```js
console.log(location.search);
// http://sindresorhus.com?foo=bar

var parsed = queryString.parse(location.search);
console.log(parsed);
// {foo: 'bar'}

parsed.foo = 'unicorn';
parsed.ilike = 'pizza';
location.search = queryString.stringify(parsed);

console.log(location.search);
// http://sindresorhus.com?foo=unicorn&ilike=pizza
```


## API

Expand Down

0 comments on commit 10517cb

Please sign in to comment.