fix: some syntax errors with the help of eslint
This commit is contained in:
parent
060f6461cb
commit
0c1f1d0beb
3 changed files with 19 additions and 4 deletions
15
.eslintrc
Normal file
15
.eslintrc
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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())
|
||||||
|
|
|
@ -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().
|
||||||
|
|
Loading…
Add table
Reference in a new issue