# perry

> Multi-dimensional query string parser and generator

Latest version **0.1.3** (published 2013-02-20) · 0 weekly downloads

## Install

```sh
npm install perry
pnpm add perry
yarn add perry
bun add perry
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2013-02-20 |
| First published | 2011-06-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Marc Greenstock |
| Maintainers | marcgreenstock |
| Keywords | multi-dimension, querystring, parser, generator |

## Links

- npm: https://www.npmjs.com/package/perry
- Repository: https://github.com/marcgreenstock/node_perry
- npm.io page: https://npm.io/package/perry

## 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

- 0.1.3 (latest) — 2013-02-20
- 0.1.2 — 2011-06-23
- 0.1.1 — 2011-06-23
- 0.1.0 — 2011-06-22
- 0.0.9 — 2011-06-18

## README

Perry
===

Multi-dimensional query string parser and generator.

Install:

    npm install perry

Require Perry:

    var Perry = require('perry');

Perry.stringify usage:

    Perry.stringify({
      foo: {
        first: {
          second: {
            third: 'bar'
          },
          another: [23,42]
        }
      }
    });

Returned result:

    foo[first][second][third]=bar&foo[first][another][0]=23&foo[first][another][1]=42

Perry.parse usage:    

    Perry.parse('foo[0][bar][0]=meh&foo[0][bar][1]=beh&foo[1][bar][0]=teh');
    
Returned result:

    {
      foo: [{
        bar: ['meh','beh']
      },{
        bar: ['teh']
      }]
    }
    
Perrry.parse a query string with empty braces will create an index array beginning with 0:

    Perry.parse('foo[]=bar&foo[]=mah');

Returned result:
    
    {
      foo: ['bar','meh']
    }

Perry.parse a query strings with a numerical index will associate an array with identical indexes:

    Perry.parse('foo[0]=bar&foo[2]=mah');
    
Returned result: 
    
    {
      foo: ['bar',undefined,'mah]
    }
    
Notice the undefined at index 1, this is to keep the array indexes consistent since foo[1] isn't present in the query string. The alternative would be to create a numerically indexed object which may not be expected behaviour considering an array is expected.

Test:

    node test/test-perry.js

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