2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('querystring-stringify-simple', function (Y, NAME) {
12 * <p>Provides Y.QueryString.stringify method for converting objects to Query Strings.
13 * This is a subset implementation of the full querystring-stringify.</p>
14 * <p>This module provides the bare minimum functionality (encoding a hash of simple values),
15 * without the additional support for nested data structures. Every key-value pair is
16 * encoded by encodeURIComponent.</p>
17 * <p>This module provides a minimalistic way for io to handle single-level objects
18 * as transaction data.</p>
21 * @submodule querystring-stringify-simple
24 var QueryString = Y.namespace("QueryString"),
25 EUC = encodeURIComponent;
28 QueryString.stringify = function (obj, c) {
30 // Default behavior is false; standard key notation.
31 s = c && c.arrayKey ? true : false,
35 if (obj.hasOwnProperty(key)) {
36 if (Y.Lang.isArray(obj[key])) {
37 for (i = 0, l = obj[key].length; i < l; i++) {
38 qs.push(EUC(s ? key + '[]' : key) + '=' + EUC(obj[key][i]));
42 qs.push(EUC(key) + '=' + EUC(obj[key]));
51 }, '3.13.0', {"requires": ["yui-base"]});