[Pkg-javascript-commits] [node-ain2] 40/102: fix jslint errors

Jonas Smedegaard js at moszumanska.debian.org
Tue Apr 29 11:59:48 UTC 2014


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

js pushed a commit to branch master
in repository node-ain2.

commit 45d12a02d219b8bb5cee2677a6997e9f6fa8c83d
Author: Patrick Huesler <patrick.huesler at gmail.com>
Date:   Mon Oct 17 14:49:36 2011 +0200

    fix jslint errors
---
 index.js | 64 +++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/index.js b/index.js
index ca6043a..5f62431 100644
--- a/index.js
+++ b/index.js
@@ -5,6 +5,34 @@ var nodeConsole = console;
 var DefaultHostname = require("os").hostname();
 var DefaultAddress = "127.0.0.1";
 
+
+function leadZero(n) {
+    if (n < 10) {
+        return '0' + n;
+    } else {
+        return n;
+    }
+}
+
+/**
+ * Get current date in syslog format. Thanks https://github.com/kordless/lodge
+ * @returns {String}
+ */
+function getDate() {
+    var dt = new Date();
+    var hours = leadZero(dt.getHours());
+    var minutes = leadZero(dt.getMinutes());
+    var seconds = leadZero(dt.getSeconds());
+    var month = dt.getMonth();
+    var day = dt.getDate();
+    if(day < 10){
+      day = ' ' + day;
+    }
+    var months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
+            'Sep', 'Oct', 'Nov', 'Dec' ];
+    return months[month] + " " + day + " " + hours + ":" + minutes + ":" + seconds;
+}
+
 var Transport = {
     UDP: function(message, severity) {
         var client = dgram.createSocket('udp4');
@@ -54,7 +82,7 @@ var Transport = {
             );
             client.close() ;
 
-        }
+        };
     })()
 };
 
@@ -98,18 +126,19 @@ var formatRegExp = /%[sdj]/g;
  * @returns
  */
 function format(f) {
-  var util = require('util');
+  var   util = require('util'),
+        i    = 0;
 
   if (typeof f !== 'string') {
     var objects = [];
-    for (var i = 0; i < arguments.length; i++) {
+    for (i = 0; i < arguments.length; i++) {
       objects.push(util.inspect(arguments[i]));
     }
     return objects.join(' ');
   }
 
 
-  var i = 1;
+  i = 1;
   var args = arguments;
   var str = String(f).replace(formatRegExp, function(x) {
     switch (x) {
@@ -130,33 +159,6 @@ function format(f) {
   return str;
 }
 
-function leadZero(n) {
-    if (n < 10) {
-        return '0' + n;
-    } else {
-        return n;
-    }
-}
-
-/**
- * Get current date in syslog format. Thanks https://github.com/kordless/lodge
- * @returns {String}
- */
-function getDate() {
-    var dt = new Date();
-    var hours = leadZero(dt.getHours());
-    var minutes = leadZero(dt.getMinutes());
-    var seconds = leadZero(dt.getSeconds());
-    var month = dt.getMonth();
-    var day = dt.getDate();
-    if(day < 10){
-      day = ' ' + day;
-    }
-    var months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
-            'Sep', 'Oct', 'Nov', 'Dec' ];
-    return months[month] + " " + day + " " + hours + ":" + minutes + ":" + seconds;
-}
-
 /**
  * Syslog logger
  * @constructor

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



More information about the Pkg-javascript-commits mailing list