[Pkg-javascript-commits] [dojo] 74/149: refs #16190, whitespace cleanup in io-query.

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository dojo.

commit 8d3ecf63b1e9d459c6222c8191ded477d3fcdf5a
Author: Simon Speich <simon.speich at gmail.com>
Date:   Fri Sep 11 09:46:16 2015 -0700

    refs #16190, whitespace cleanup in io-query.
---
 io-query.js | 173 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 86 insertions(+), 87 deletions(-)

diff --git a/io-query.js b/io-query.js
index f8cf1e1..08416bc 100644
--- a/io-query.js
+++ b/io-query.js
@@ -1,97 +1,96 @@
 define(["./_base/lang"], function(lang){
 
-// module:
-//		dojo/io-query
+	// module:
+	//		dojo/io-query
 
-var backstop = {};
+	var backstop = {};
 
-return {
-// summary:
-//		This module defines query string processing functions.
-
-	objectToQuery: function objectToQuery(/*Object*/ map){
+	return {
 		// summary:
-        //		takes a name/value mapping object and returns a string representing
-        //		a URL-encoded version of that object.
-        // example:
-        //		this object:
-        //
-        //	|	{
-        //	|		blah: "blah",
-        //	|		multi: [
-        //	|			"thud",
-        //	|			"thonk"
-        //	|		]
-        //	|	};
-        //
-        //		yields the following query string:
-        //
-        //	|	"blah=blah&multi=thud&multi=thonk"
+		//		This module defines query string processing functions.
+
+		objectToQuery: function objectToQuery(/*Object*/ map){
+			// summary:
+			//		takes a name/value mapping object and returns a string representing
+			//		a URL-encoded version of that object.
+			// example:
+			//		this object:
+			//
+			//	|	{
+			//	|		blah: "blah",
+			//	|		multi: [
+			//	|			"thud",
+			//	|			"thonk"
+			//	|		]
+			//	|	};
+			//
+			//		yields the following query string:
+			//
+			//	|	"blah=blah&multi=thud&multi=thonk"
 
-        // FIXME: need to implement encodeAscii!!
-        var enc = encodeURIComponent, pairs = [];
-        for(var name in map){
-            var value = map[name];
-            if(value != backstop[name]){
-                var assign = enc(name) + "=";
-                if(lang.isArray(value)){
-                    for(var i = 0, l = value.length; i < l; ++i){
-                        pairs.push(assign + enc(value[i]));
-                    }
-                }else{
-                    pairs.push(assign + enc(value));
-                }
-            }
-        }
-        return pairs.join("&"); // String
-    },
+			// FIXME: need to implement encodeAscii!!
+			var enc = encodeURIComponent, pairs = [];
+			for(var name in map){
+				var value = map[name];
+				if(value != backstop[name]){
+					var assign = enc(name) + "=";
+					if(lang.isArray(value)){
+						for(var i = 0, l = value.length; i < l; ++i){
+							pairs.push(assign + enc(value[i]));
+						}
+					}else{
+						pairs.push(assign + enc(value));
+					}
+				}
+			}
+			return pairs.join("&"); // String
+		},
 
-	queryToObject: function queryToObject(/*String*/ str){
-        // summary:
-        //		Create an object representing a de-serialized query section of a
-        //		URL. Query keys with multiple values are returned in an array.
-        //
-        // example:
-        //		This string:
-        //
-        //	|		"foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
-        //
-        //		results in this object structure:
-        //
-        //	|		{
-        //	|			foo: [ "bar", "baz" ],
-        //	|			thinger: " spaces =blah",
-        //	|			zonk: "blarg"
-        //	|		}
-        //
-        //		Note that spaces and other urlencoded entities are correctly
-        //		handled.
+		queryToObject: function queryToObject(/*String*/ str){
+			// summary:
+			//		Create an object representing a de-serialized query section of a
+			//		URL. Query keys with multiple values are returned in an array.
+			//
+			// example:
+			//		This string:
+			//
+			//	|		"foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
+			//
+			//		results in this object structure:
+			//
+			//	|		{
+			//	|			foo: [ "bar", "baz" ],
+			//	|			thinger: " spaces =blah",
+			//	|			zonk: "blarg"
+			//	|		}
+			//
+			//		Note that spaces and other urlencoded entities are correctly
+			//		handled.
 
-        // FIXME: should we grab the URL string if we're not passed one?
-        var dec = decodeURIComponent, qp = str.split("&"), ret = {}, name, val;
-        for(var i = 0, l = qp.length, item; i < l; ++i){
-            item = qp[i];
-            if(item.length){
-                var s = item.indexOf("=");
-                if(s < 0){
-                    name = dec(item);
-                    val = "";
-                }else{
-                    name = dec(item.slice(0, s));
-                    val  = dec(item.slice(s + 1));
-                }
-                if(typeof ret[name] == "string"){ // inline'd type check
-                    ret[name] = [ret[name]];
-                }
+        	var dec = decodeURIComponent, qp = str.split("&"), ret = {}, name, val;
+			for(var i = 0, l = qp.length, item; i < l; ++i){
+				item = qp[i];
+				if(item.length){
+					var s = item.indexOf("=");
+					if(s < 0){
+						name = dec(item);
+						val = "";
+					}else{
+						name = dec(item.slice(0, s));
+						val = dec(item.slice(s + 1));
+					}
+					if(typeof ret[name] == "string"){ // inline'd type check
+						ret[name] = [ret[name]];
+					}
 
-                if(lang.isArray(ret[name])){
-                    ret[name].push(val);
-                }else{
-                    ret[name] = val;
-                }
-            }
-        }
-        return ret; // Object
-    }
-};
+					if(lang.isArray(ret[name])){
+						ret[name].push(val);
+					}else{
+						ret[name] = val;
+					}
+				}
+			}
+			return ret; // Object
+		}
+	};
 });
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list