Yahoo! UI Library

querystring  3.3.0

Yahoo! UI Library > querystring > QueryString
Search:
 
Filters

static Class QueryString

The QueryString module adds support for serializing JavaScript objects into query strings and parsing JavaScript objects from query strings format.

The QueryString namespace is added to your YUI instance including static methods Y.QueryString.parse(..) and Y.QueryString.stringify(..).

The querystring module is a rollup of querystring-parse and querystring-stringify.

As their names suggest, querystring-parse adds support for parsing Query String data (Y.QueryString.parse) and querystring-stringify for serializing JavaScript data into Query Strings (Y.QueryString.stringify). You may choose to include either of the submodules individually if you don't need the complementary functionality, or include the rollup for both.

Methods

parse

static void parse ( qs , sep , eq )
Provides Y.QueryString.parse method to accept Query Strings and return native JavaScript objects.
Parameters:
qs <String> Querystring to be parsed into an object.
sep <String> (optional) Character that should join param k=v pairs together. Default: "&"
eq <String> (optional) Character that should join keys to their values. Default: "="

stringify

static void stringify ( obj , cfg )

Converts a simple object to a Query String representation.

Nested objects, Arrays, and so on, are not supported.

Parameters:
obj <Object> A single-level object to convert to a querystring.
cfg <Object> (optional) Configuration object. In the simple module, only the arrayKey setting is supported. When set to true, the key of an array will have the '[]' notation appended to the key;.

unescape

static void unescape ( s )
Provides Y.QueryString.unescape method to be able to override default decoding method. This is important in cases where non-standard delimiters are used, if the delimiters would not normally be handled properly by the builtin (en|de)codeURIComponent functions. Default: replace "+" with " ", and then decodeURIComponent behavior.
Parameters:
s <String> String to be decoded.


Copyright © 2011 Yahoo! Inc. All rights reserved.