Nightly Procrastination Machine

    query-parse

    2.0.0 • Public • Published

    query-parse

    Parse query strings to objects and objects to strings.

    USEFUL: Removes null or empty values. It also sorts the params alphabetically, so you will always get the same string for the same params.

    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
    

    Install

    npm i query-parse

    DownloadsWeekly Downloads

    367

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • scottcorgan