Skip to content
/ qs Public
forked from request/qs

Wrapper for qs and querystring modules

License

Notifications You must be signed in to change notification settings

isabella232/qs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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.

About

Wrapper for qs and querystring modules

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%