@request/qs
v0.1.0
Published
Wrapper for qs and querystring modules
Downloads
80
Readme
@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.