fix: some syntax errors with the help of eslint

This commit is contained in:
Tobi Schäfer 2020-03-21 15:35:25 +01:00
parent 060f6461cb
commit 0c1f1d0beb
3 changed files with 19 additions and 4 deletions

15
.eslintrc Normal file
View file

@ -0,0 +1,15 @@
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"commonjs": true
},
"globals": {
"app": "readonly",
"HopObject": "readonly",
"java": "readonly",
"Packages": "readonly",
"req": "readonly",
"res": "readonly"
}
}

View file

@ -180,7 +180,7 @@ Date.prototype.getExpiry = function(param) {
*/ */
Date.prototype.equals = function(date, extend) { Date.prototype.equals = function(date, extend) {
if (!extend) if (!extend)
var extend = Date.ONEDAY; extend = Date.ONEDAY;
switch (extend) { switch (extend) {
case Date.ONESECOND: case Date.ONESECOND:
if (this.getSeconds() != date.getSeconds()) if (this.getSeconds() != date.getSeconds())

View file

@ -97,7 +97,7 @@ function encode(text, encodeNewLine) {
if (text === null || !text.length) return text; if (text === null || !text.length) return text;
var buffer = []; var buffer = [];
if (typeof encodeNewline === 'undefined') encodeNewline = true; if (typeof encodeNewLine === 'undefined') encodeNewLine = true;
for (var i = 0, len = text.length; i < len; i += 1) { for (var i = 0, len = text.length; i < len; i += 1) {
var char = text.charAt(i); var char = text.charAt(i);
@ -120,7 +120,7 @@ function encode(text, encodeNewLine) {
break; break;
case '\n': case '\n':
if (encodeNewline) { if (encodeNewLine) {
buffer.push("<br/>"); buffer.push("<br/>");
} }
buffer.push('\n'); buffer.push('\n');
@ -178,7 +178,7 @@ function encodeXml(text) {
break; break;
default: default:
var charCode = str.charCodeAt(i); var charCode = text.charCodeAt(i);
if (charCode < 0x20) { if (charCode < 0x20) {
// sort out invalid XML characters below 0x20 - all but 0x9, 0xA and 0xD. // sort out invalid XML characters below 0x20 - all but 0x9, 0xA and 0xD.
// The trick is an adaption of java.lang.Character.isSpace(). // The trick is an adaption of java.lang.Character.isSpace().