~ubuntu-branches/ubuntu/trusty/moodle/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/yuilib/3.9.1/build/querystring-stringify-simple/querystring-stringify-simple.js

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2013-07-19 08:52:46 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130719085246-yebwditc2exoap2r
Tags: 2.5.1-1
* New upstream version: 2.5.1.
  - Fixes security issues:
    CVE-2013-2242 CVE-2013-2243 CVE-2013-2244 CVE-2013-2245
    CVE-2013-2246
* Depend on apache2 instead of obsolete apache2-mpm-prefork.
* Use packaged libphp-phpmailer (closes: #429339), adodb,
  HTMLPurifier, PclZip.
* Update debconf translations, thanks Salvatore Merone, Pietro Tollot,
  Joe Hansen, Yuri Kozlov, Holger Wansing, Américo Monteiro,
  Adriano Rafael Gomes, victory, Michał Kułach.
  (closes: #716972, #716986, #717080, #717108, #717278)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* YUI 3.9.1 (build 5852) Copyright 2013 Yahoo! Inc. http://yuilibrary.com/license/ */
 
2
YUI.add('querystring-stringify-simple', function (Y, NAME) {
 
3
 
 
4
/*global Y */
 
5
/**
 
6
 * <p>Provides Y.QueryString.stringify method for converting objects to Query Strings.
 
7
 * This is a subset implementation of the full querystring-stringify.</p>
 
8
 * <p>This module provides the bare minimum functionality (encoding a hash of simple values),
 
9
 * without the additional support for nested data structures.  Every key-value pair is
 
10
 * encoded by encodeURIComponent.</p>
 
11
 * <p>This module provides a minimalistic way for io to handle  single-level objects
 
12
 * as transaction data.</p>
 
13
 *
 
14
 * @module querystring
 
15
 * @submodule querystring-stringify-simple
 
16
 */
 
17
 
 
18
var QueryString = Y.namespace("QueryString"),
 
19
    EUC = encodeURIComponent;
 
20
 
 
21
 
 
22
QueryString.stringify = function (obj, c) {
 
23
    var qs = [],
 
24
        // Default behavior is false; standard key notation.
 
25
        s = c && c.arrayKey ? true : false,
 
26
        key, i, l;
 
27
 
 
28
    for (key in obj) {
 
29
        if (obj.hasOwnProperty(key)) {
 
30
            if (Y.Lang.isArray(obj[key])) {
 
31
                for (i = 0, l = obj[key].length; i < l; i++) {
 
32
                    qs.push(EUC(s ? key + '[]' : key) + '=' + EUC(obj[key][i]));
 
33
                }
 
34
            }
 
35
            else {
 
36
                qs.push(EUC(key) + '=' + EUC(obj[key]));
 
37
            }
 
38
        }
 
39
    }
 
40
 
 
41
    return qs.join('&');
 
42
};
 
43
 
 
44
 
 
45
}, '3.9.1', {"requires": ["yui-base"]});