# awesome-querystring

> Awesome and robust querystring

Latest version **1.2.0** (published 2019-02-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install awesome-querystring
pnpm add awesome-querystring
yarn add awesome-querystring
bun add awesome-querystring
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-02-26 |
| First published | 2018-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Favna |
| Maintainers | favna. |
| Keywords | querystring, stringify, parse, typescript, awesome, html, url |

## Links

- npm: https://www.npmjs.com/package/awesome-querystring
- Repository: https://github.com/favna/awesome-querystring
- Issues: https://github.com/favna/awesome-querystring/issues
- npm.io page: https://npm.io/package/awesome-querystring

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2019-02-26
- 1.1.5 — 2019-01-13
- 1.1.4 — 2019-01-11
- 1.1.3 — 2019-01-03
- 1.1.2 — 2019-01-02
- 1.1.1 — 2019-01-01
- 1.1.0 — 2018-12-31
- 1.0.1 — 2018-12-29
- 1.0.0 — 2018-12-28

## README

<div align="center">
  <p>
  <a href="https://favna.xyz/querystring"><img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/website-project-icons/querystring.png" height="200" alt="logo"/></a>
  </p>

  <p>
<h1> Awesome Querystring </h1>
<h3> Querystring that is robust in its working yet remains awesome to TypeScript users </h3>
  </p>
<p>
  <a href="https://depfu.com/repos/Favna/awesome-querystring"><img src="https://img.shields.io/depfu/Favna/awesome-querystring.svg?style=flat-square" alt="Depfu" title="Depfu" /></a><!--
  --><a href="https://github.com/Favna/awesome-querystring/blob/awesome-querystring/LICENSE.md"><img src="https://img.shields.io/github/license/favna/awesome-querystring.svg?style=flat-square" alt="License" title="License"></a><!--
  --><a href="https://circleci.com/gh/Favna/awesome-querystring/tree/master"><img src="https://img.shields.io/circleci/project/github/Favna/awesome-querystring/master.svg?style=flat-square" alt="Build Status" title="Build Status" /></a>
</p>

<p>
  <a href="https://www.npmjs.com/package/awesome-querystring"><img src="https://img.shields.io/bundlephobia/min/awesome-querystring.svg?style=popout-square" alt="NPM bundle size (minified)" title="NPM bundle size (minified)" /></a><!--
  --><a href="https://www.npmjs.com/package/awesome-querystring"><img src="https://img.shields.io/bundlephobia/minzip/awesome-querystring.svg?style=flat-square" alt="NPM bundle size (minified + gzip)" title="NPM bundle size (minified + gzip)" /></a><!--  --><a href="https://www.npmjs.com/package/awesome-querystring"><img src="https://img.shields.io/npm/v/awesome-querystring.svg?style=flat-square" alt="NPM Version" title="NPM Version" /></a><!--
  --><a href="https://www.npmjs.com/package/awesome-querystring"><img src="https://img.shields.io/npm/dw/awesome-querystring.svg?style=flat-square" alt="NPM Weekly Downloads" title="NPM Weekly Downloads" /></a><!--
  --><a href="https://www.npmjs.com/package/awesome-querystring"><img src="https://img.shields.io/npm/dt/awesome-querystring.svg?style=flat-square" alt="NPM Total Downloads" title="NPM Total Downloads" /></a>
</p>

<p>
  <a href="https://twitter.com/Favna_/follow"><img src="https://img.shields.io/badge/twitter-follow-brightgreen.svg?logo=twitter&colorB=1DA1F2&style=flat-square&link=https://twitter.com/Favna_/follow" alt="Follow me on Twitter" title="Follow me on Twitter" /></a><!--
  --><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMAYCF9SDHZ34"><img src="https://img.shields.io/badge/paypal-donate-brightgreen.svg?logo=paypal&colorB=00457C&style=flat-square&link=https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMAYCF9SDHZ34" alt="Donate with PayPal" title="Donate with PayPal" /></a><!--
  --><a href="https://www.patreon.com/bePatron?u=9336537"><img src="https://img.shields.io/badge/patreon-donate-brightgreen.svg?logo=patreon&colorB=F96854&style=flat-square&link=https://www.patreon.com/bePatron?u=9336537" alt="Become a Patron" title="Become a Patron" /></a>
</p>

<p>
  <a href="https://favna.xyz/redirect/server"><img src="https://discordapp.com/api/guilds/512303595966824458/widget.png?style=banner2" alt="Join Discord Server"/></a>
  <br/>
  <a href="https://nodei.co/npm/awesome-querystring"><img src="https://nodei.co/npm/awesome-querystring.png" alt="NPM Stats" title="NPM Stats" /></a>
</p>
</div>

---

Created out of a frustration with the node default querystring as well as for TypeScript based projects that do not require @types/node

# Install

Install with [yarn](https://yarnpkg.com):

```sh
$ yarn add awesome-querystring
```

# Usage

## Stringify

Create a querystring from a JS object

```js
const { stringify } = require('awesome-querystring');
// or for TypeScript:
// import { stringify } from 'awesome-querystring';

console.log(stringify({prop: 'value', prop2: 'value2'}));
//=> '?prop=value&prop2=value2'

// supply options
console.log(stringify({prop: 'value', prop2: 'value2'}, {separator: '&', equals: '=', includeQuestion: true}));
//=> '?prop=value&prop2=value2'

// customize options
console.log(stringify({prop: 'value', prop2: 'value2'}, {separator: '&&', equals: '=', includeQuestion: false}));
//=> 'prop=value&&prop2=value2'
```

## Parse

Create a JS object from a querystring

```js
const { parse } = require('awesome-querystring');
// or for TypeScript:
// import { parse } from 'awesome-querystring';

console.log(parse('?prop=value&prop2=value2'));
//=> {prop: 'value', prop2: 'value2'}

// supply options
console.log(parse('?prop=value&prop2=value2', {separator: '&', equals: '='}));
//=> {prop: 'value', prop2: 'value2'}

// customize options
console.log(parse('prop=value&&prop2=value2', {separator: '&&', equals: '='}));
//=> {prop: 'value', prop2: 'value2'}
```

# Documentation

## Functions

<dl>
<dt><a href="#stringify">stringify(obj, [options])</a> ⇒ <code>string</code></dt>
<dd><p>Stringifies an object</p></dd>
<dt><a href="#parse">parse(qs, [options])</a> ⇒ <code>IAwesomeQuerystringObject</code></dt>
<dd><p>Parses a querystring back to an object</p></dd>
</dl>

## Typedefs

<dl>
<dt><a href="#IStringifyOptions">IStringifyOptions</a> : <code><a href="#IStringifyOptions">IStringifyOptions</a></code></dt>
<dd><p>Options for the Stringify function</p></dd>
<dt><a href="#IParseOptions">IParseOptions</a> : <code><a href="#IParseOptions">IParseOptions</a></code></dt>
<dd><p>Options for the Parse function</p></dd>
</dl>

<a name="stringify"></a>

## stringify(obj, [options]) ⇒ <code>string</code>
<p>Stringifies an object</p>

**Kind**: global function  

| Param | Type | Description |
| --- | --- | --- |
| obj | <code>IAwesomeQuerystringObject</code> | <p>Object to stringify</p> |
| [options] | [<code>IStringifyOptions</code>](#IStringifyOptions) | <p>Options for the stringify, see [IStringifyOptions](#IStringifyOptions)</p> |

<a name="parse"></a>

## parse(qs, [options]) ⇒ <code>IAwesomeQuerystringObject</code>
<p>Parses a querystring back to an object</p>

**Kind**: global function  

| Param | Type | Description |
| --- | --- | --- |
| qs | <code>string</code> | <p>Querystring to parse</p> |
| [options] | [<code>IParseOptions</code>](#IParseOptions) | <p>Options for the parse, see [IParseOptions](#IParseOptions)</p> |

<a name="IStringifyOptions"></a>

## IStringifyOptions : [<code>IStringifyOptions</code>](#IStringifyOptions)
<p>Options for the Stringify function</p>

**Kind**: global typedef  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| separator | <code>string</code> | <p>separator the querystring should get</p> |
| equals | <code>string</code> | <p>equals sign the querystring should use</p> |
| includeQuestion | <code>boolean</code> | <p>whether the querystring should be prefixed with a <code>?</code></p> |

<a name="IParseOptions"></a>

## IParseOptions : [<code>IParseOptions</code>](#IParseOptions)
<p>Options for the Parse function</p>

**Kind**: global typedef  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| separator | <code>string</code> | <p>separator the querystring has</p> |
| equals | <code>string</code> | <p>equals sign the querystring has</p> |


* * *

# About

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://www.github.com/favna/awesome-querystring/issues/new).

## License

Copyright © 2018-2019, [Favna](https://github.com/favna).
Released under the [MIT License](LICENSE).

## Buy me a donut

This project is open source and always will be, even if I don't get donations. That said, I know there are people out there that may still want to donate just to show their appreciation so this is for you guys. Thanks in advance!

I accept donations through PayPal, BitCoin, Ethereum and LiteCoin. You can use the buttons below to donate through your method of choice

|Donate With|QR|Address|
|:---:|:---:|:---:|
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMAYCF9SDHZ34"><img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/paypaldonate.png"></a>|<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMAYCF9SDHZ34"><img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/paypalqr.png" width="128"></a>|[Donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMAYCF9SDHZ34)|
<img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/bitcoindonate.png">|<img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/bitcoinqr.png" width="128">|<a href="bitcoin:1E643TNif2MTh75rugepmXuq35Tck4TnE5?amount=0.01&label=Favna%27%20Ribbon%20Discord%20Bot">1E643TNif2MTh75rugepmXuq35Tck4TnE5</a>|
<img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/ethereumdonate.png">|<img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/ethereumqr.png" width="128">|<a href="ethereum:0xF653F666903cd8739030D2721bF01095896F5D6E?amount=0.01&label=Favna%27%20Ribbon%20Discord%20Bot">0xF653F666903cd8739030D2721bF01095896F5D6E</a>|
<img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/litecoindonate.png">|<img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/ribbon/litecoinqr.png" width="128">|<a href="litecoin:LZHvBkaJqKJRa8N7Dyu41Jd1PDBAofCik6?amount=0.01&label=Favna%27%20Ribbon%20Discord%20Bot">LZHvBkaJqKJRa8N7Dyu41Jd1PDBAofCik6</a>|

---
_Source: https://npm.io/package/awesome-querystring · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
