From 516320c79a71a0dd1e2f4d7f4f2a8fff31951143 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Thu, 30 May 2013 08:26:03 +1000 Subject: [PATCH] more linting --- lib/levels.js | 69 ++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/lib/levels.js b/lib/levels.js index 91199ba..0637099 100644 --- a/lib/levels.js +++ b/lib/levels.js @@ -1,6 +1,8 @@ +"use strict"; + function Level(level, levelStr) { - this.level = level; - this.levelStr = levelStr; + this.level = level; + this.levelStr = levelStr; } /** @@ -13,55 +15,54 @@ function Level(level, levelStr) { function toLevel(sArg, defaultLevel) { if (!sArg) { - return defaultLevel; + return defaultLevel; } if (typeof sArg == "string") { - var s = sArg.toUpperCase(); - if (module.exports[s]) { - return module.exports[s]; - } else { - return defaultLevel; - } + var s = sArg.toUpperCase(); + if (module.exports[s]) { + return module.exports[s]; + } else { + return defaultLevel; + } } return toLevel(sArg.toString()); - -}; +} Level.prototype.toString = function() { - return this.levelStr; + return this.levelStr; }; Level.prototype.isLessThanOrEqualTo = function(otherLevel) { - if (typeof otherLevel === "string") { - otherLevel = toLevel(otherLevel); - } - return this.level <= otherLevel.level; + if (typeof otherLevel === "string") { + otherLevel = toLevel(otherLevel); + } + return this.level <= otherLevel.level; }; Level.prototype.isGreaterThanOrEqualTo = function(otherLevel) { - if (typeof otherLevel === "string") { - otherLevel = toLevel(otherLevel); - } - return this.level >= otherLevel.level; + if (typeof otherLevel === "string") { + otherLevel = toLevel(otherLevel); + } + return this.level >= otherLevel.level; }; Level.prototype.isEqualTo = function(otherLevel) { - if (typeof otherLevel == "string") { - otherLevel = toLevel(otherLevel); - } - return this.level === otherLevel.level; -} + if (typeof otherLevel == "string") { + otherLevel = toLevel(otherLevel); + } + return this.level === otherLevel.level; +}; module.exports = { - ALL: new Level(Number.MIN_VALUE, "ALL") - , TRACE: new Level(5000, "TRACE") - , DEBUG: new Level(10000, "DEBUG") - , INFO: new Level(20000, "INFO") - , WARN: new Level(30000, "WARN") - , ERROR: new Level(40000, "ERROR") - , FATAL: new Level(50000, "FATAL") - , OFF: new Level(Number.MAX_VALUE, "OFF") - , toLevel: toLevel + ALL: new Level(Number.MIN_VALUE, "ALL"), + TRACE: new Level(5000, "TRACE"), + DEBUG: new Level(10000, "DEBUG"), + INFO: new Level(20000, "INFO"), + WARN: new Level(30000, "WARN"), + ERROR: new Level(40000, "ERROR"), + FATAL: new Level(50000, "FATAL"), + OFF: new Level(Number.MAX_VALUE, "OFF"), + toLevel: toLevel };