2010-10-28 14:18:16 +02:00
|
|
|
## Query String
|
|
|
|
|
2010-11-18 13:00:24 +01:00
|
|
|
This module provides utilities for dealing with query strings.
|
|
|
|
It provides the following methods:
|
2010-10-28 14:18:16 +02:00
|
|
|
|
|
|
|
### querystring.stringify(obj, sep='&', eq='=')
|
|
|
|
|
2010-11-18 13:00:24 +01:00
|
|
|
Serialize an object to a query string.
|
|
|
|
Optionally override the default separator and assignment characters.
|
2010-10-28 14:18:16 +02:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
querystring.stringify({foo: 'bar'})
|
|
|
|
// returns
|
|
|
|
'foo=bar'
|
|
|
|
|
|
|
|
querystring.stringify({foo: 'bar', baz: 'bob'}, ';', ':')
|
|
|
|
// returns
|
|
|
|
'foo:bar;baz:bob'
|
|
|
|
|
|
|
|
### querystring.parse(str, sep='&', eq='=')
|
|
|
|
|
2010-11-18 13:00:24 +01:00
|
|
|
Deserialize a query string to an object.
|
|
|
|
Optionally override the default separator and assignment characters.
|
2010-10-28 14:18:16 +02:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
querystring.parse('a=b&b=c')
|
|
|
|
// returns
|
2010-11-18 03:25:14 +01:00
|
|
|
{ a: 'b', b: 'c' }
|
2010-10-28 14:18:16 +02:00
|
|
|
|
|
|
|
### querystring.escape
|
|
|
|
|
2010-11-18 13:00:24 +01:00
|
|
|
The escape function used by `querystring.stringify`,
|
|
|
|
provided so that it could be overridden if necessary.
|
2010-10-28 14:18:16 +02:00
|
|
|
|
|
|
|
### querystring.unescape
|
|
|
|
|
2010-11-18 13:00:24 +01:00
|
|
|
The unescape function used by `querystring.parse`,
|
|
|
|
provided so that it could be overridden if necessary.
|