aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-03-23 20:18:23 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-03-23 20:18:23 +0100
commit2e5993bc9bd0d468f4e9d12dd39e0548ba9adda1 (patch)
treef31a0d612efbfa5beb78e4718768c55c650f14d8 /lib/util.js
parentc662ccddab2cbcc6d13f49a21c04a6aea808f457 (diff)
downloadbugzilla-triage-2e5993bc9bd0d468f4e9d12dd39e0548ba9adda1.tar.gz
Fix indentation and else for Mozilla coding guidelines.
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js60
1 files changed, 30 insertions, 30 deletions
diff --git a/lib/util.js b/lib/util.js
index 089e31c..d28f001 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -12,26 +12,26 @@ var urlMod = require("url");
* get parameters of URL as an object (name, value)
*/
function getParamsFromURL (url, base) {
- if (!url || (url.toString().length === 0)) {
- throw new Error("Missing URL value!");
- }
+ if (!url || (url.toString().length === 0)) {
+ throw new Error("Missing URL value!");
+ }
- if (!(url instanceof urlMod.URL)) {
- url = new urlMod.URL(url.toString(), base);
- }
+ if (!(url instanceof urlMod.URL)) {
+ url = new urlMod.URL(url.toString(), base);
+ }
- var paramsArr = url.path.split("?");
- if (paramsArr.length === 1) {
- return {};
+ var paramsArr = url.path.split("?");
+ if (paramsArr.length === 1) {
+ return {};
}
- // get convert URL parameters to an Object
- var params = {}, s = [];
- paramsArr[1].split('&').forEach(function(par) {
- s = par.split('=');
- params[s[0]] = s[1];
- });
- return params;
+ // get convert URL parameters to an Object
+ var params = {}, s = [];
+ paramsArr[1].split('&').forEach(function(par) {
+ s = par.split('=');
+ params[s[0]] = s[1];
+ });
+ return params;
}
/**
@@ -43,10 +43,10 @@ function getParamsFromURL (url, base) {
* @return String with the bug ID (hopefully number, but not for aliases)
*/
exports.getBugNo = function getBugNo(url) {
- var params = getParamsFromURL(url);
- if (params && params.id) {
- return params.id;
- }
+ var params = getParamsFromURL(url);
+ if (params && params.id) {
+ return params.id;
+ }
};
/**
@@ -56,20 +56,20 @@ exports.getBugNo = function getBugNo(url) {
* @return string with the formatted date
*/
exports.getISODate = function getISODate(dateStr) {
- function pad(n) {
- return n < 10 ? '0' + n : n;
- }
- var date = new Date(dateStr);
- return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' +
- pad(date.getDate());
+ function pad(n) {
+ return n < 10 ? '0' + n : n;
+ }
+ var date = new Date(dateStr);
+ return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' +
+ pad(date.getDate());
};
/**
* object to pack messaging. Use as in
- postMessage(new Message("GetPassword", {
- login: login,
- hostname: location.hostname
- }));
+ postMessage(new Message("GetPassword", {
+ login: login,
+ hostname: location.hostname
+ }));
*/
exports.Message = function Message(cmd, data) {
this.cmd = cmd;