Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Parse query strings to objects and objects to strings. Hides null or empty values.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
README.md
index.js
package.json

README.md

query-parse

Parse query strings to objects and objects to strings. USEFUL: Removes null or empty values.

Install

NPM

Usage

var qp = require('query-parse');

var paramStr = qp.toString({
  param1: 'foo',
  param2: 'bar';
});

// Outputs: "param1=foo&param2=bar";

var paramObj = qp.toObject('param1=foo&param2=bar&param3=');

// Outputs: 
//  {
//    param1: 'foo',
//    param2: 'bar'
//  }
//
// Ignores blank parameters for both toString and toObject

Test

npm test
Something went wrong with that request. Please try again.