This module provides utilities for dealing with query strings. Call require('url')
to use it. This is port of NodeJS querystring module.
Small sample:
var querystring = require('querystring');
querystring.stringify({param1: 'value1', param2: ['arr1', 'arr2'], paramEmpty: '' })
// returns 'param1=value1¶m2=arr1¶m2=arr2¶mEmpty='
Methods
parse(obj, sepopt, eqopt, optionsopt)
inner
Deserialize a query string to an object. Optionally override the default separator ('&') and assignment ('=') characters.
Options object may contain maxKeys property (equal to 1000 by default), it'll be used to limit processed keys. Set it to 0 to remove key count limitation.
Example:
querystring.parse('foo=bar&baz=qux&baz=quux&corge')
// returns
{ foo: 'bar', baz: ['qux', 'quux'], corge: '' }
Arguments:
-
obj
(Object)
-
[sep="&"]
(String)
-
[eq="="]
(String)
-
[options]
(Object)
Properties
-
[maxKeys=1000]
(Number)
Deserialize a query string to an object. Optionally override the default separator ('&') and assignment ('=') characters.
Options object may contain maxKeys property (equal to 1000 by default), it'll be used to limit processed keys. Set it to 0 to remove key count limitation.
Example:
querystring.parse('foo=bar&baz=qux&baz=quux&corge')
// returns
{ foo: 'bar', baz: ['qux', 'quux'], corge: '' }
obj
(Object)
[sep="&"]
(String)
[eq="="]
(String)
[options]
(Object)
Properties
-
[maxKeys=1000]
(Number)