Created
May 18, 2010 19:58
-
-
Save robi42/405459 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/modules/core/array.js b/modules/core/array.js | |
index 138131b..e35a1cd 100644 | |
--- a/modules/core/array.js | |
+++ b/modules/core/array.js | |
@@ -135,7 +135,7 @@ Object.defineProperty(Array.prototype, "partition", { | |
falses.push(this[i]); | |
} | |
} | |
- return [trues, falses] | |
+ return [trues, falses]; | |
}, writable: true | |
}); | |
diff --git a/modules/core/date.js b/modules/core/date.js | |
index 3dbc591..65b251f 100644 | |
--- a/modules/core/date.js | |
+++ b/modules/core/date.js | |
@@ -55,8 +55,8 @@ Object.defineProperty(Date.prototype, "format", { | |
if (typeof timezone == "string") { | |
timezone = java.util.TimeZone.getTimeZone(timezone); | |
} | |
- var sdf = locale ? new java.text.SimpleDateFormat(format, locale) | |
- : new java.text.SimpleDateFormat(format); | |
+ var sdf = locale ? new java.text.SimpleDateFormat(format, locale) : | |
+ new java.text.SimpleDateFormat(format); | |
if (timezone && timezone != sdf.getTimeZone()) | |
sdf.setTimeZone(timezone); | |
return sdf.format(this); | |
@@ -132,7 +132,7 @@ Object.defineProperty(Date.prototype, "getTimespan", { | |
{one: "minute", many: "minutes"}]; | |
for (var i in arr) { | |
var value = age[arr[i].many]; | |
- if (value != 0) { | |
+ if (value !== 0) { | |
var prop = (value == 1 ? arr[i].one : arr[i].many); | |
res.write(value); | |
res.write(" "); | |
@@ -207,6 +207,8 @@ Object.defineProperty(Date.prototype, "equals", { | |
case Date.ONEYEAR: | |
if (this.getFullYear() != date.getFullYear()) | |
return false; | |
+ default: | |
+ break; | |
} | |
return true; | |
}, writable: true | |
diff --git a/modules/core/number.js b/modules/core/number.js | |
index 2a867b3..f12d345 100644 | |
--- a/modules/core/number.js | |
+++ b/modules/core/number.js | |
@@ -11,7 +11,7 @@ | |
Object.defineProperty(Number.prototype, 'format', { | |
value: function(fmt, locale) { | |
var symbols; | |
- if (locale != null) { | |
+ if (locale !== undefined) { | |
symbols = new java.text.DecimalFormatSymbols(locale); | |
} else { | |
symbols = new java.text.DecimalFormatSymbols(); | |
diff --git a/modules/core/string.js b/modules/core/string.js | |
index d9c0583..64a3589 100644 | |
--- a/modules/core/string.js | |
+++ b/modules/core/string.js | |
@@ -110,7 +110,7 @@ Object.defineProperty(String.prototype, "toFileName", { | |
Object.defineProperty(String.prototype, "isHexColor", { | |
value: function() { | |
var str = this; | |
- if (this.indexOf("#") == 0) | |
+ if (this.indexOf("#") === 0) | |
str = this.substring(1); | |
if (str.length != 6) | |
return false; | |
@@ -223,7 +223,7 @@ Object.defineProperty(String.prototype, "toCamelCase", { | |
*/ | |
Object.defineProperty(String.prototype, "capitalize", { | |
value: function(limit) { | |
- if (limit == null) | |
+ if (limit === undefined) | |
limit = 1; | |
var head = this.substring(0, limit); | |
var tail = this.substring(limit, this.length); | |
@@ -281,8 +281,8 @@ Object.defineProperty(String.prototype, "group", { | |
for (var i=0; i<this.length; i=i+interval) { | |
var strPart = this.substring(i, i+interval); | |
buffer.push(strPart); | |
- if (ignoreWhiteSpace == true || | |
- (strPart.length == interval && !/\s/g.test(strPart))) { | |
+ if (ignoreWhiteSpace === true || | |
+ (strPart.length == interval && !(/\s/g).test(strPart))) { | |
buffer.push(str); | |
} | |
} | |
@@ -299,7 +299,7 @@ Object.defineProperty(String.prototype, "group", { | |
*/ | |
Object.defineProperty(String.prototype, "unwrap", { | |
value: function(removeTags, replacement) { | |
- if (replacement == null) | |
+ if (replacement === undefined) | |
replacement = ''; | |
var str = this.replace(/[\n|\r]/g, replacement); | |
if (removeTags) | |
diff --git a/modules/ringo/admin/main.js b/modules/ringo/admin/main.js | |
index 6922d08..4903ae5 100644 | |
--- a/modules/ringo/admin/main.js | |
+++ b/modules/ringo/admin/main.js | |
@@ -18,7 +18,7 @@ function main(args) { | |
function printUsage() { | |
var resources = getRepository("./").getResources(); | |
print("Please specify one of the following commands:"); | |
- for each(var res in resources.sort()) { | |
+ for each (var res in resources.sort()) { | |
if (res.baseName != "main") { | |
var description = require(res.moduleName).description; | |
print(" ", res.baseName, "\t-", description || "no description available"); | |
diff --git a/modules/ringo/global.js b/modules/ringo/global.js | |
index 9627770..1a77d03 100644 | |
--- a/modules/ringo/global.js | |
+++ b/modules/ringo/global.js | |
@@ -99,7 +99,7 @@ Object.defineProperty(this, "global", { value: this }); | |
// Include file and line number in error.toString() - better error messages ftw! | |
Error.prototype.toString = function() { | |
- if (this.fileName && this.lineNumber != null) { | |
+ if (this.fileName && this.lineNumber !== null) { | |
return [ | |
this.name, ": ", | |
this.message, " (", | |
diff --git a/modules/ringo/middleware/error.js b/modules/ringo/middleware/error.js | |
index 42c6189..e158d92 100644 | |
--- a/modules/ringo/middleware/error.js | |
+++ b/modules/ringo/middleware/error.js | |
@@ -14,7 +14,7 @@ exports.middleware = function(app) { | |
} catch (error if !error.retry && !error.notfound) { | |
return handleError(request, error); | |
} | |
- } | |
+ }; | |
}; | |
function handleError(request, error) { | |
@@ -33,7 +33,7 @@ function handleError(request, error) { | |
} | |
if (error.stack) { | |
res.writeln('<h3>Script Stack</h3>'); | |
- res.writeln('<pre>', error.stack, '</pre>'); | |
+ res.writeln('<pre>', error.stack, '</pre>'); | |
} | |
if (error.rhinoException) { | |
res.writeln('<h3>Java Stack</h3>'); | |
@@ -41,7 +41,7 @@ function handleError(request, error) { | |
var printer = new java.io.PrintWriter(writer); | |
error.rhinoException.printStackTrace(printer); | |
res.writeln('<pre>', writer.toString().escapeHtml(), '</pre>'); | |
- } | |
+ } | |
res.writeln('</body></html>'); | |
log.error(error); | |
return res.close(); | |
@@ -61,4 +61,3 @@ function renderSyntaxError(error) { | |
} | |
return buffer; | |
} | |
- | |
diff --git a/modules/ringo/middleware/profiler.js b/modules/ringo/middleware/profiler.js | |
index 82f1534..55abfc8 100644 | |
--- a/modules/ringo/middleware/profiler.js | |
+++ b/modules/ringo/middleware/profiler.js | |
@@ -32,5 +32,5 @@ exports.middleware = function(app) { | |
} finally { | |
log.info("\n" + profiler.formatResult(maxFrames)); | |
} | |
- } | |
+ }; | |
}; | |
diff --git a/modules/ringo/subprocess.js b/modules/ringo/subprocess.js | |
index 2355c7d..13f8856 100644 | |
--- a/modules/ringo/subprocess.js | |
+++ b/modules/ringo/subprocess.js | |
@@ -27,7 +27,7 @@ exports.command = function() { | |
var error = new TextStream(new MemoryStream()); | |
connect(process, output, error); | |
var status = process.waitFor(); | |
- if (status != 0) { | |
+ if (status !== 0) { | |
throw new Error("(" + status + ") " + error.content); | |
} | |
return output.content; | |
@@ -64,7 +64,7 @@ function dummyStream() { | |
seekable: function() false, | |
write: function() this, | |
flush: function() this, | |
- close: function() this | |
+ close: function() this | |
} | |
} | |
diff --git a/modules/ringo/unittest.js b/modules/ringo/unittest.js | |
index 48e73c1..5162c3c 100644 | |
--- a/modules/ringo/unittest.js | |
+++ b/modules/ringo/unittest.js | |
@@ -1,4 +1,4 @@ | |
-import("core/string"); | |
+require("core/string"); | |
var term = require("ringo/term"); | |
var fs = require("fs"); | |
diff --git a/modules/ringo/webapp/mime.js b/modules/ringo/webapp/mime.js | |
index efd2fb4..7069666 100644 | |
--- a/modules/ringo/webapp/mime.js | |
+++ b/modules/ringo/webapp/mime.js | |
@@ -4,7 +4,7 @@ | |
exports.mimeType = function(fileName, fallback) { | |
var ext = fileName.slice(fileName.lastIndexOf('.')).toLowerCase(); | |
return this.MIME_TYPES[ext] || fallback || 'application/octet-stream'; | |
-}, | |
+}; | |
// List of most common mime-types, stolen from Rack. | |
exports.MIME_TYPES = { | |
@@ -173,4 +173,4 @@ exports.MIME_TYPES = { | |
".yaml" : "text/yaml", | |
".yml" : "text/yaml", | |
".zip" : "application/zip" | |
-} | |
+}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment