query-parse

Parse query strings to objects and objects to strings. Hides null or empty values.

query-parse

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

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 
 
npm test