@request/qs

0.1.0 • Public • Published

@request/qs

Wrapper for the qs and querystring modules.

See @request/core for more details.

defaults

By default @request/qs uses the qs module:

var qs = require('@request/qs')

qs.parse(str)
qs.stringify(obj)

qs options

var qs = require('@request/qs')

var options = {
  // parse options
  parse: {
    qs: {sep: ';', eq: ':'}
  },
  // stringify options
  stringify: {
    qs: {sep: ';', eq: ':'}
  }
}

qs.parse(str, options)
qs.stringify(obj, options)

using querystring

To use the querystring module instead, set the parse and stringify option keys to querystring:

var qs = require('@request/qs')

var options = {
  parse: {querystring: {}},
  stringify: {querystring: {}}
}

qs.parse(str, options)
qs.stringify(obj, options)

querystring options

Here sep and eq are the second and third argument for the querystring's parse and stringify methods. The options key is the forth object argument:

var qs = require('@request/qs')

var options = {
  // parse options
  parse: {
    querystring: {sep: ';', eq: ':', options: {}}
  },
  // stringify options
  stringify: {
    querystring: {sep: ';', eq: ':', options: {}}
  }
}

qs.parse(str, options)
qs.stringify(obj, options)

The stringified result is RFC3986 encoded.

Notice

This module may contain code snippets initially implemented in request by request contributors.

Package Sidebar

Install

npm i @request/qs

Weekly Downloads

5

Version

0.1.0

License

MIT

Last publish

Collaborators

  • request
  • simov