diff -r d334a616c023 -r e16a97fb364a src/cm/media/js/lib/yui/yui3-3.15.0/build/querystring-stringify-simple/querystring-stringify-simple.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui3-3.15.0/build/querystring-stringify-simple/querystring-stringify-simple.js Mon Mar 10 15:19:48 2014 +0100 @@ -0,0 +1,44 @@ +YUI.add('querystring-stringify-simple', function (Y, NAME) { + +/*global Y */ +/** + *
Provides Y.QueryString.stringify method for converting objects to Query Strings. + * This is a subset implementation of the full querystring-stringify.
+ *This module provides the bare minimum functionality (encoding a hash of simple values), + * without the additional support for nested data structures. Every key-value pair is + * encoded by encodeURIComponent.
+ *This module provides a minimalistic way for io to handle single-level objects + * as transaction data.
+ * + * @module querystring + * @submodule querystring-stringify-simple + */ + +var QueryString = Y.namespace("QueryString"), + EUC = encodeURIComponent; + + +QueryString.stringify = function (obj, c) { + var qs = [], + // Default behavior is false; standard key notation. + s = c && c.arrayKey ? true : false, + key, i, l; + + for (key in obj) { + if (obj.hasOwnProperty(key)) { + if (Y.Lang.isArray(obj[key])) { + for (i = 0, l = obj[key].length; i < l; i++) { + qs.push(EUC(s ? key + '[]' : key) + '=' + EUC(obj[key][i])); + } + } + else { + qs.push(EUC(key) + '=' + EUC(obj[key])); + } + } + } + + return qs.join('&'); +}; + + +}, '@VERSION@', {"requires": ["yui-base"]});