Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juliendargelos/parameters-js

Simply manage url parameters.
https://github.com/juliendargelos/parameters-js

Last synced: 4 days ago
JSON representation

Simply manage url parameters.

Awesome Lists containing this project

README

        

# Parameters JS 🔑
[![npm version](https://badge.fury.io/js/parameters-js.svg)](https://badge.fury.io/js/parameters-js)
[![Maintainability](https://api.codeclimate.com/v1/badges/ef4ed91e5826a0767fae/maintainability)](https://codeclimate.com/github/juliendargelos/parameters-js/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/ef4ed91e5826a0767fae/test_coverage)](https://codeclimate.com/github/juliendargelos/parameters-js/test_coverage)

Simply manage url parameters.

## Install

```
npm install parameters-js
```

## Usage

```javascript
var Parameters = require('parameters-js');

var parameters = new Parameters();

parameters.post = 2;
parameters.string;
// => "post=2"

parameters.date = '10/12/1997';
parameters.string;
// => "post=2&date=10%2F12%2F1997"

parameters.authors = [
{name: 'Marie', country: 'England'},
{name: 'Marc', country: 'France'}
];
parameters.string;
// => "post=2&date=10%2F12%2F1997&authors[][name]=Marie&authors[][country]=England&authors[][name]=Marc&authors[][country]=France"

var otherParameters = new Parameters();
otherParameters.string = "post=2&date=10%2F12%2F1997&authors[][name]=Marie&authors[][country]=England&authors[][name]=Marc&authors[][country]=France";
otherParameters;
// => Parameters {
// post: '2',
// date: '10/12/1997',
// authors: [
// {name: 'Marie', country: 'England'},
// {name: 'Marc', country: 'France'}
// ]
// }
```

{{>main}}