# query-string-object

> support object or array like php did: ?a[]=1&a[]=2 -> a=[1,2]

Latest version **0.2.5** (published 2016-09-27) · 0 weekly downloads

## Install

```sh
npm install query-string-object
pnpm add query-string-object
yarn add query-string-object
bun add query-string-object
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2016-09-27 |
| First published | 2014-07-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | 木酱 |
| Maintainers | ericdum |
| Keywords | querystring, object, array, php, query, extend, string, rest, restful |

## Links

- npm: https://www.npmjs.com/package/query-string-object
- Repository: https://github.com/ericdum/querystring
- Homepage: https://github.com/ericdum/querystring/
- Issues: https://github.com/ericdum/querystring/issues
- npm.io page: https://npm.io/package/query-string-object

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ~3.8.0
- [querystring-browser](https://npm.io/package/querystring-browser.md) ^1.0.4

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.2.5 (latest) — 2016-09-27
- 0.2.4 — 2016-09-12
- 0.2.3 — 2016-09-09
- 0.2.2 — 2015-05-07
- 0.2.1 — 2015-05-07
- 0.2.0 — 2015-05-07
- 0.1.1 — 2014-07-15
- 0.1.0 — 2014-07-13
- 0.0.7 — 2014-07-11
- 0.0.6 — 2014-07-11
- 0.0.5 — 2014-07-11
- 0.0.4 — 2014-07-11
- 0.0.3 — 2014-07-11
- 0.0.2 — 2014-07-11
- 0.0.1 — 2014-07-10

## README

##querystring [![Build Status](https://travis-ci.org/ericdum/querystring.svg?branch=master)](https://travis-ci.org/ericdum/querystring)

support object or array like php did: ?a[]=1&a[]=2 -> a=[1,2]

###Usage

install in shell

```shell
npm install query-string-object
```

in js file

```javascript
qs = require('query-string-object')
qs('xx=yy&zz..') // just like what is pass to the native qs.parse
qs.stringify({
  fInt: 1,
  fString: 'string',
  fObject: {
    anobject: {a:1, b:2},
    anything: 'thing'
  },
  fArray: [1,2,"string"]
}) 
// fInt=1&fString=string&fObject[anobject][a]=1&fObject[anobject][b]=2&fObject[anything]=thing&fArray[]=1&fArray[]=2&fArray[]=string
```

###Tests

```shell
npm install
./node_modules/.bin/mocha --reporter tap test.js
```

###Expects

####a=1&b=2

output

```
{
  a:1,
  b:2 
}
```

####a=1&b[]=1&b[]=2&c=3

output

```
({
  a: 1,
  b: [1, 2],
  c: 3
});
```

####a=1&b[]=1&c=3

output

```
({
  a: 1,
  b: [1],
  c: 3
});
```

####a=1&b[1]=1&c[3]=2&c=3

output

```
({
  a: 1,
  b: {
    1: 1
  },
  c: {
    3: 2
  }
});
```

####a=1&b[eric]=dum&c[stive]=jobs&c=3

```
output
({
  a: 1,
  b: {
    eric: "dum"
  },
  c: {
    stive: "jobs"
  }
});
```

####a=1&b[eric]=dum&b[stive]=jobs&c=3

output

```
({
  a: 1,
  b: {
    eric: "dum",
    stive: "jobs"
  },
  c: 3
});
```

####a=1&b[eric][]=dum&b[stive][]=jobs&b[stive][]=fans&c=3

output

```
({
  a: 1,
  b: {
    eric: ["dum"],
    stive: ["jobs", "fans"]
  },
  c: 3
});
```

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